Skip to content

Commit 5cd5520

Browse files
tomymaritanoclaude
andcommitted
fix: use gh pr merge --auto for automerge workflow
Replace peter-evans action with gh CLI which doesn't need pull-request-number input and works directly with PR events. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 09ac09a commit 5cd5520

1 file changed

Lines changed: 15 additions & 22 deletions

File tree

.github/workflows/automerge.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,30 @@
11
name: Auto-merge
22

33
on:
4-
pull_request_review:
5-
types: [submitted]
6-
check_suite:
7-
types: [completed]
8-
workflow_run:
9-
workflows: [CI]
10-
types: [completed]
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
116

127
permissions:
138
contents: write
149
pull-requests: write
1510

1611
jobs:
17-
automerge:
12+
automerge-owner:
1813
runs-on: ubuntu-latest
19-
if: >-
20-
github.event.pull_request.user.login == 'tomymaritano' ||
21-
github.event.workflow_run.head_repository.owner.login == 'tomymaritano'
14+
if: github.event.pull_request.user.login == 'tomymaritano'
2215
steps:
2316
- name: Enable auto-merge for owner PRs
24-
uses: peter-evans/enable-pull-request-automerge@v3
25-
with:
26-
token: ${{ secrets.GITHUB_TOKEN }}
27-
merge-method: merge
17+
env:
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
PR_NUMBER: ${{ github.event.pull_request.number }}
20+
run: gh pr merge "$PR_NUMBER" --auto --merge --repo "$GITHUB_REPOSITORY"
2821

29-
dependabot:
22+
automerge-dependabot:
3023
runs-on: ubuntu-latest
31-
if: github.actor == 'dependabot[bot]'
24+
if: github.event.pull_request.user.login == 'dependabot[bot]'
3225
steps:
33-
- name: Auto-merge dependabot PRs
34-
uses: peter-evans/enable-pull-request-automerge@v3
35-
with:
36-
token: ${{ secrets.GITHUB_TOKEN }}
37-
merge-method: merge
26+
- name: Enable auto-merge for dependabot PRs
27+
env:
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
PR_NUMBER: ${{ github.event.pull_request.number }}
30+
run: gh pr merge "$PR_NUMBER" --auto --merge --repo "$GITHUB_REPOSITORY"

0 commit comments

Comments
 (0)