CI: Add workaround for github uppercase usernames
authorEdward Chow <equu@openmail.cc>
Mon, 3 Oct 2022 11:39:58 +0000 (19:39 +0800)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Sun, 4 Dec 2022 15:27:00 +0000 (16:27 +0100)
The workflow defined in tools.yml and kernel.yml used to fail on
forked repositories of contributers whose github username contains
uppercase letters.

A workaround mentioned in
https://github.com/orgs/community/discussions/27086 and
https://stackoverflow.com/questions/70326569/ is applied.

Signed-off-by: Edward Chow <equu@openmail.cc>
(cherry picked from commit c27b43956407f3adc3cc2693792acd6b40a01877)

.github/workflows/kernel.yml
.github/workflows/tools.yml

index 5589610d08e1b0975f8a31a1c274c19eb43d7b3d..6c8ad68438d7259e57b39677a1961a943f90c88d 100644 (file)
@@ -17,11 +17,19 @@ jobs:
     runs-on: ubuntu-latest
     outputs:
       target: ${{ steps.find_targets.outputs.target }}
+      owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
 
     steps:
       - name: Checkout
         uses: actions/checkout@v2
 
+      - name: Set lower case owner name
+        id: lower_owner
+        run: |
+          OWNER_LC=$(echo "${{ github.repository_owner }}" \
+            | tr '[:upper:]' '[:lower:]')
+          echo "::set-output name=owner_lc::$OWNER_LC"
+
       - name: Set targets
         id: find_targets
         run: |
@@ -53,7 +61,7 @@ jobs:
        matrix:
          target: ${{fromJson(needs.determine_targets.outputs.target)}}
 
-    container: ghcr.io/${{ github.repository_owner }}/tools:latest
+    container: ghcr.io/${{ needs.determine_targets.outputs.owner_lc }}/tools:latest
 
     permissions:
       contents: read
index 54b7a01fe5e7b7ccc8ad300f888e1790f9132df5..573bb468b95917e81dac6dc4dfd87f8109eee093 100644 (file)
@@ -167,6 +167,12 @@ jobs:
       packages: write
 
     steps:
+      - name: Set lower case owner name
+        env:
+          OWNER: ${{ github.repository_owner }}
+        run: |
+          echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
+
       - name: Checkout
         uses: actions/checkout@v2
         with:
@@ -190,5 +196,5 @@ jobs:
         with:
           context: openwrt
           push: true
-          tags: ghcr.io/${{ github.repository_owner }}/tools:latest
+          tags: ghcr.io/${{ env.OWNER_LC }}/tools:latest
           file: openwrt/.github/workflows/Dockerfile.tools