ci: let the master-to-main merge wait for every required check

The auto-merge job fires when CI finishes, but Code Quality, Security and
CodeQL can still be running then. Once main requires those checks, a direct
merge at that moment is refused and nothing would retry it. Try the merge,
and if the branch rules do not allow it yet, hand it to GitHub auto-merge.
This commit is contained in:
Satoshi Qazi Muhammed committed 2026-10-12 11:40:45 +04:00
1 parent bfb2b74aed
commit b44b84f0a3
1 file changed
+8 -1
+8 -1
View File
@@ -40,8 +40,15 @@ jobs:
exit 0
fi
# CI finishing does not mean every required check has: Code Quality,
# Security and CodeQL may still be running. Merge now if the branch
# rules allow it, otherwise let GitHub merge once they pass.
echo "Merging PR #$PR_NUMBER"
gh pr merge "$PR_NUMBER" \
--repo "$GITHUB_REPOSITORY" \
--merge \
--delete-branch=false
--delete-branch=false \
|| gh pr merge "$PR_NUMBER" \
--repo "$GITHUB_REPOSITORY" \
--merge \
--auto