From 5441a02d593e93dab337ad085b83589a5f4ea388 Mon Sep 17 00:00:00 2001 From: puddly <32534428+puddly@users.noreply.github.com> Date: Wed, 1 May 2024 06:32:10 -0400 Subject: [PATCH] Fix Git repo permissions during CI (#52) * WIP: debug * WIP: test * WIP: test 2 * WIP: run on any push * WIP: Use newer version of checkout action to avoid `safe.directory` error * WIP: Pin exact version * Move registry to env var * Revert "WIP: Pin exact version" This reverts commit 846e64d7e10e68aa965e959f0b9b312fc0773a8c. * Revert "WIP: Use newer version of checkout action to avoid `safe.directory` error" This reverts commit 36f1e662c42fb3a9473868f36946c22407a1df2a. * WIP: Fix repo ownership --- .github/workflows/build.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1ff5d813..761f6a6f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,14 +2,9 @@ name: Build firmwares on: push: - paths: - - Dockerfile - - .github/workflows/build.yaml - - manifests/**/*.yaml - branches: - - main - tags: - - '*' + +env: + REGISTRY: ghcr.io jobs: build-container: @@ -23,7 +18,7 @@ jobs: id: create-container-name run: | repository_owner=$(echo $GITHUB_REPOSITORY_OWNER | tr [:upper:] [:lower:]) - image_name="ghcr.io/$repository_owner/silabs-firmware-builder" + image_name="${{ env.REGISTRY }}/$repository_owner/silabs-firmware-builder" tag_name="${{ hashFiles('Dockerfile') }}" echo "image_name=$image_name" >> $GITHUB_OUTPUT @@ -32,7 +27,7 @@ jobs: - name: Log in to the GitHub container registry uses: docker/login-action@v2.1.0 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx @@ -103,6 +98,9 @@ jobs: - name: Build firmware run: | + # Fix `fatal: detected dubious ownership in repository at` + git config --global --add safe.directory "$GITHUB_WORKSPACE" + # Pass all SDKs as consecutive `--sdk ...` arguments sdk_args="" for sdk_dir in /gecko_sdk*; do