Skip to content

Commit 073359c

Browse files
authored
ci(automerge): use AUTOMERGE_PAT with GITHUB_TOKEN fallback (#49)
The default GITHUB_TOKEN cannot enable auto-merge on PRs that modify .github/workflows/** (github-actions ecosystem bumps), so those Dependabot PRs stall and need a manual/admin merge. Allow an optional AUTOMERGE_PAT secret (repo + workflow scope) to be used for `gh pr merge --auto`, falling back to GITHUB_TOKEN when the secret is not set — so behavior is unchanged until the secret is added.
1 parent 0eef2e4 commit 073359c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/dependabot-auto-merge.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,8 @@ jobs:
2323
run: gh pr merge --auto --merge "$PR_URL"
2424
env:
2525
PR_URL: ${{ github.event.pull_request.html_url }}
26-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
# AUTOMERGE_PAT (repo+workflow scope) lets auto-merge work on PRs that
27+
# touch .github/workflows/** (e.g. github-actions bumps); the default
28+
# GITHUB_TOKEN is forbidden by GitHub from doing so. Falls back to
29+
# GITHUB_TOKEN when the secret is absent (unchanged behavior).
30+
GH_TOKEN: ${{ secrets.AUTOMERGE_PAT || secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)