From e99999e7250b98d97e7cf0cf593828c404fc30c0 Mon Sep 17 00:00:00 2001 From: mhucka Date: Fri, 29 Aug 2025 20:48:53 +0000 Subject: [PATCH 1/2] Set GH_REPO for the `gh` CLI tool Unless executed in a git repository, `gh` no longer seems to get information about the current repo where it's executing, which leads to failures like the one in #889. A simple solution is to set the `$GH_TOKEN` environment variable, which `gh` uses if it's defined. --- .github/workflows/ci-build-checks.yaml | 2 ++ .github/workflows/ci-file-checks.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci-build-checks.yaml b/.github/workflows/ci-build-checks.yaml index 7bea7be03..c80921594 100644 --- a/.github/workflows/ci-build-checks.yaml +++ b/.github/workflows/ci-build-checks.yaml @@ -120,6 +120,7 @@ jobs: id: files env: GH_TOKEN: ${{github.token}} + GH_REPO: ${{github.repository}} # Note that this approach doesn't need to check out a copy of the repo. run: | set -x +e @@ -232,6 +233,7 @@ jobs: continue-on-error: true env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + GH_REPO: ${{github.repository}} run: | key="${{steps.parameters.outputs.python_cache_key}}" gh extension install actions/gh-actions-cache diff --git a/.github/workflows/ci-file-checks.yaml b/.github/workflows/ci-file-checks.yaml index 9caf9657b..d59af715d 100644 --- a/.github/workflows/ci-file-checks.yaml +++ b/.github/workflows/ci-file-checks.yaml @@ -87,6 +87,7 @@ jobs: name: Use the user-provided SHA as the basis for comparison env: GH_TOKEN: ${{github.token}} + GH_REPO: ${{github.repository}} run: | set -x +e url="repos/${{github.repository}}/commits/${{inputs.sha}}" @@ -181,6 +182,7 @@ jobs: continue-on-error: true env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + GH_REPO: ${{github.repository}} run: | key="${{steps.parameters.outputs.cache_key}}" gh extension install actions/gh-actions-cache From 4e59529e876f5953e2a593746567c002c924d235 Mon Sep 17 00:00:00 2001 From: mhucka Date: Fri, 29 Aug 2025 20:56:55 +0000 Subject: [PATCH 2/2] Need to provide the PR number, not the URL --- .github/workflows/ci-build-checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build-checks.yaml b/.github/workflows/ci-build-checks.yaml index c80921594..f52247862 100644 --- a/.github/workflows/ci-build-checks.yaml +++ b/.github/workflows/ci-build-checks.yaml @@ -127,8 +127,8 @@ jobs: # shellcheck disable=SC2207 # Get an array of paths changed in this workflow trigger event. if [[ "${{github.event_name}}" == "pull_request" ]]; then - url=${{github.event.pull_request.url}} - paths=($(gh pr view $url --json files --jq '.files | .[].path')) + pr=${{github.event.pull_request.number}} + paths=($(gh pr view $pr --json files --jq '.files | .[].path')) else # There's no event sha for manual runs, so we rely on user input. # Make sure the sha is valid.