File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ # -----------------------------------------------------------------
2+ # Dependabot & Pre-commit Auto-merge
3+ #
4+ # Auto-approves and enables squash auto-merge for:
5+ # - Dependabot PRs (all ecosystems)
6+ # - Pre-commit hook update PRs (chore/update-pre-commit-hooks branch)
7+ #
8+ # Requires: PRE_COMMIT_PAT secret (fine-grained PAT with PR write)
9+ # to satisfy CODEOWNERS approval requirement.
10+ #
11+ # Gate: CI must pass before GitHub executes the auto-merge.
12+ # -----------------------------------------------------------------
13+ name : Auto-merge Dependabot & Pre-commit
14+ run-name : " Auto-merge: PR #${{ github.event.pull_request.number }}"
15+
16+ on :
17+ pull_request_target :
18+ types : [opened, synchronize, reopened]
19+
20+ permissions :
21+ contents : write
22+ pull-requests : write
23+
24+ jobs :
25+ auto-merge :
26+ name : Auto-approve and merge
27+ runs-on : ubuntu-latest
28+ if : >-
29+ github.actor == 'dependabot[bot]' ||
30+ startsWith(github.head_ref, 'chore/update-pre-commit-hooks')
31+ steps :
32+ - name : Approve PR (as repo owner via PAT)
33+ run : gh pr review --approve "$PR_URL"
34+ env :
35+ PR_URL : ${{ github.event.pull_request.html_url }}
36+ GH_TOKEN : ${{ secrets.PRE_COMMIT_PAT }}
37+
38+ - name : Enable auto-merge (squash)
39+ run : gh pr merge --auto --squash "$PR_URL"
40+ env :
41+ PR_URL : ${{ github.event.pull_request.html_url }}
42+ GH_TOKEN : ${{ secrets.PRE_COMMIT_PAT }}
You can’t perform that action at this time.
0 commit comments