Browse Source

Follow up - 0798e7d47ed2505ea43dccdb9c1ef867d700f720 - moved from circle ci to github actions. Fixed bug: GITHUB_ACTOR is the user initiating the commit not the repository owner. Applied workaround to extract the repository owner from the GitHub Actions GITHUB_REPOSITORY ENV instead because there is no dedicated ENV for that.

Thorsten Eckel 5 years ago
parent
commit
dd96c57f48

+ 3 - 1
.github/docker-image-build.sh

@@ -13,7 +13,9 @@ ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')"
 echo "${DOCKER_PASSWORD}" | docker login --username="${DOCKER_USERNAME}" --password-stdin
 
 # clone docker repo
-git clone https://github.com/"${REPO_USER}"/"${DOCKER_GITHUB_REPOSITORY}"
+DOCKER_REPOSITORY_CLONE_URL="https://github.com/${REPO_USER}/${DOCKER_GITHUB_REPOSITORY}"
+echo "Cloning ${DOCKER_REPOSITORY_CLONE_URL}"
+git clone "${DOCKER_REPOSITORY_CLONE_URL}"
 
 # enter dockerfile dir
 cd "${REPO_ROOT}/${DOCKER_GITHUB_REPOSITORY}"

+ 3 - 4
.github/workflows/build-docker-compose-images.yaml

@@ -14,10 +14,9 @@ jobs:
       DOCKER_REPOSITORY: "zammad-docker-compose"
       DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
     steps:
-     - name: Alias GITHUB_ACTOR as REPO_USER
-      run: |
-        echo "::set-env name=REPO_USER::$GITHUB_ACTOR"
-     - name: Checkout code
+      - name: Extract REPO_USER from GITHUB_REPOSITORY ENV
+        run: echo "::set-env name=REPO_USER::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')"
+      - name: Checkout code
         uses: actions/checkout@master
       - name: Fetch all history for all tags and branches
         run: git fetch --prune --unshallow

+ 2 - 3
.github/workflows/build-docker-image.yaml

@@ -14,9 +14,8 @@ jobs:
       DOCKER_REPOSITORY: "zammad"
       DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
     steps:
-      - name: Alias GITHUB_ACTOR as REPO_USER
-        run: |
-          echo "::set-env name=REPO_USER::$GITHUB_ACTOR"
+      - name: Extract REPO_USER from GITHUB_REPOSITORY ENV
+        run: echo "::set-env name=REPO_USER::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')"
       - name: Checkout code
         uses: actions/checkout@master
       - name: Fetch all history for all tags and branches