···17 # as specified in nixos/release-combined.nix
18 runs-on: ubuntu-latest
19 steps:
000000000020 - uses: actions/checkout@v4
21 with:
22 # pull_request_target checks out the base branch by default
23- ref: refs/pull/${{ github.event.pull_request.number }}/merge
24 # Fetches the merge commit and its parents
25 fetch-depth: 2
26 - name: Determining PR git hashes
27 run: |
28- echo "mergedSha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
29-30 # For pull_request_target this is the same as $GITHUB_SHA
31 echo "baseSha=$(git rev-parse HEAD^1)" >> "$GITHUB_ENV"
32
···17 # as specified in nixos/release-combined.nix
18 runs-on: ubuntu-latest
19 steps:
20+ - name: Resolving the merge commit
21+ run: |
22+ if result=$(git ls-remote --exit-code ${{ github.event.pull_request.base.repo.clone_url }} refs/pull/${{ github.event.pull_request.number }}/merge); then
23+ mergedSha=$(cut -f1 <<< "$result")
24+ echo "The PR appears to not have any conflicts, checking the merge commit $mergedSha"
25+ else
26+ echo "The PR may have a merge conflict"
27+ exit 1
28+ fi
29+ echo "mergedSha=$mergedSha" >> "$GITHUB_ENV"
30 - uses: actions/checkout@v4
31 with:
32 # pull_request_target checks out the base branch by default
33+ ref: ${{ env.mergedSha }}
34 # Fetches the merge commit and its parents
35 fetch-depth: 2
36 - name: Determining PR git hashes
37 run: |
0038 # For pull_request_target this is the same as $GITHUB_SHA
39 echo "baseSha=$(git rev-parse HEAD^1)" >> "$GITHUB_ENV"
40