workflows/eval: fix comparison with merge conflicts

In PRs with multiple commits and merge conflicts the logic "targetSha ==
immediate parent of mergedSha" doesn't hold anymore. The head and base
commits of the PR's branch have some commits inbetween them, instead.

Before this change, we'd get a "fatal: invalid reference" on the
"worktree add". Now, not anymore, because we fetch the right commit
directly.
This commit is contained in:
Wolfgang Walther 2025-05-25 13:42:32 +02:00
parent 72200554df
commit cd9a22d753
No known key found for this signature in database
GPG key ID: B39893FA5F65CAE1

View file

@ -101,7 +101,6 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.prepare.outputs.mergedSha }}
fetch-depth: 2
path: nixpkgs
- name: Install Nix
@ -168,6 +167,7 @@ jobs:
env:
AUTHOR_ID: ${{ github.event.pull_request.user.id }}
run: |
git -C nixpkgs fetch --depth 1 origin ${{ needs.prepare.outputs.targetSha }}
git -C nixpkgs worktree add ../target ${{ needs.prepare.outputs.targetSha }}
git -C nixpkgs diff --name-only ${{ needs.prepare.outputs.targetSha }} \
| jq --raw-input --slurp 'split("\n")[:-1]' > touched-files.json