You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Attempt to enable auto-merge. The gh CLI doesn't provide structured error codes,
61
-
# so we must parse error messages. Common expected errors:
62
-
# - "auto-merge is already enabled" - auto-merge was already set
63
-
# - "not authorized for this protected branch" - branch protection requirements not yet met
64
-
# NOTE: This typically occurs when the GITHUB_TOKEN doesn't have sufficient permissions.
65
-
# For workflows triggered by Dependabot PRs, the token has restricted permissions even
66
-
# with contents:write and pull-requests:write. Solutions include:
67
-
# 1. Use a GitHub App token (most secure)
68
-
# 2. Use a PAT stored in secrets (simpler but less secure)
69
-
# 3. Use pull_request_target trigger (has security implications)
70
-
# - "Required status checks" - waiting for CI checks to pass
71
-
# - "Required approving review" - waiting for approval
72
60
set -o pipefail
73
61
if ! gh pr merge --auto --merge "${{ steps.pr.outputs.number }}" --repo "${{ github.repository }}" 2>&1 | tee /tmp/gh-output.txt; then
74
-
if grep -qE "auto-merge is already enabled|not authorized for this protected branch|[Rr]equired.*status.*check|[Rr]equired approving review|[Rr]equired.*review" /tmp/gh-output.txt; then
62
+
if grep -qE "auto-merge is already enabled|[Rr]equired.*status.*check|[Rr]equired approving review|[Rr]equired.*review" /tmp/gh-output.txt; then
75
63
echo "Auto-merge not enabled yet - this is expected when requirements are not met or already enabled"
76
-
if grep -q "not authorized for this protected branch" /tmp/gh-output.txt; then
77
-
echo ""
78
-
echo "NOTE: The 'not authorized for this protected branch' error typically means:"
79
-
echo " - The GITHUB_TOKEN has restricted permissions when triggered by Dependabot PRs"
80
-
echo " - To fix this, consider using a GitHub App token or PAT with appropriate permissions"
0 commit comments