From 5318c0ae6b972afb64b4a9404f9d32bb2ebc5031 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:53:32 +0100 Subject: [PATCH] [CI] Improve fetching of changed files PRs always use a merge into the repo on checkout, so checking for `HEAD^1` will show all the changes regardless of the number of commits in a PR (cherry picked from commit 950743c3d87275a65a99fd9dffc9250669eefec1) --- .github/workflows/static_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index fba556bb6cd..909f9ed36a3 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -32,7 +32,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | if [ "${{ github.event_name }}" == "pull_request" ]; then - files=$(gh pr diff ${{ github.event.pull_request.number }} --name-only) + files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true) elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true) fi