fix(release): fall back to direct merge when auto-merge is rejected (#71)
On repos without required status checks in branch protection, GitHub rejects enablePullRequestAutoMerge with 'clean status' error. Add a fallback to direct squash merge so releases complete without manual intervention. Fixes: https://github.com/privilegedescalation/.github/issues/70 Co-authored-by: Hugh Hackman <hugh@privilegedescalation.github>
This commit is contained in:
committed by
GitHub
parent
6668041530
commit
0ac29784ee
@@ -260,6 +260,12 @@ jobs:
|
||||
--body "$BODY" \
|
||||
--base main \
|
||||
--head "release/v${VERSION}"
|
||||
gh pr merge "release/v${VERSION}" --auto --squash --delete-branch
|
||||
# Try auto-merge first (works on repos with required status checks pending).
|
||||
# Fall back to direct squash merge on repos without required status checks
|
||||
# (auto-merge is rejected when there are no pending required checks to wait for).
|
||||
if ! gh pr merge "release/v${VERSION}" --auto --squash --delete-branch 2>/dev/null; then
|
||||
echo "Auto-merge not available (no pending required status checks). Falling back to direct squash merge."
|
||||
gh pr merge "release/v${VERSION}" --squash --delete-branch
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
Reference in New Issue
Block a user