Rollup merge of #140703 - Kobzol:post-merge-race-fix, r=marcoieni

Handle PR not found in post-merge workflow

Should hopefully fix errors like [these](https://github.com/rust-lang/rust/pull/140561#issuecomment-2854636223).

r? `@marcoieni`
This commit is contained in:
Guillaume Gomez 2025-05-06 19:27:40 +02:00 committed by GitHub
commit ee0d68fcab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,12 +25,19 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
# Give GitHub some time to propagate the information that the PR was merged
sleep 60
# Get closest bors merge commit
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
echo "Parent: ${PARENT_COMMIT}"
# Find PR for the current commit
HEAD_PR=`gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number'`
if [ -z "${HEAD_PR}" ]; then
echo "PR for commit SHA ${{ github.sha }} not found, exiting"
exit 1
fi
echo "HEAD: ${{ github.sha }} (#${HEAD_PR})"
cd src/ci/citool