From acc215ef2341728e545724693d57aa7be743b347 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:03:46 +0800 Subject: [PATCH] workflows/actionlint: fix SARIF file upload Fixes git call failed. Continuing with commit SHA from user input or environment. Error: The checkout path provided to the action does not appear to be a git repository. https://github.com/Homebrew/homebrew-core/actions/runs/11586126460/job/32256194100#step:6:22 --- .github/workflows/actionlint.yml | 33 ++++++++------------------------ 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 6958bb116be6..3da4e4711210 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -38,17 +38,22 @@ jobs: cask: false test-bot: false - - name: Set up actionlint + - name: Install tools + run: brew install actionlint shellcheck zizmor + + - name: Set up GITHUB_WORKSPACE env: HOMEBREW_TAP_REPOSITORY: ${{ steps.setup-homebrew.outputs.repository-path }} run: | - brew install actionlint shellcheck - # Annotations work only relative to GITHUB_WORKSPACE (shopt -s dotglob; rm -rf "${GITHUB_WORKSPACE:?}"/*; mv "${HOMEBREW_TAP_REPOSITORY:?}"/* "$GITHUB_WORKSPACE") rmdir "$HOMEBREW_TAP_REPOSITORY" ln -vs "$GITHUB_WORKSPACE" "$HOMEBREW_TAP_REPOSITORY" + - run: zizmor --format sarif . >results.sarif + + - name: Set up actionlint + run: | # Setting `shell: /bin/bash` prevents shellcheck from running on # those steps, so let's change them to `shell: bash` for linting. sed -i 's|shell: /bin/bash -x|shell: bash -x|' .github/workflows/*.y*ml @@ -58,28 +63,6 @@ jobs: - run: actionlint - zizmor: - if: github.repository_owner == 'Homebrew' - runs-on: ubuntu-latest - container: - image: ghcr.io/homebrew/ubuntu22.04:master - steps: - - name: Set up Homebrew - id: setup-homebrew - uses: Homebrew/actions/setup-homebrew@master - with: - core: true - cask: false - test-bot: false - - - name: Install zizmor - run: brew install zizmor - - - name: Run zizmor - run: zizmor --format sarif "${HOMEBREW_TAP_REPOSITORY}" | tee results.sarif - env: - HOMEBREW_TAP_REPOSITORY: ${{ steps.setup-homebrew.outputs.repository-path }} - - name: Upload SARIF file uses: github/codeql-action/upload-sarif@v3 with: