Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Enable automerge on dependabot PRs

on:
pull_request_target:
Comment thread
jeswr marked this conversation as resolved.
branches:
- main

jobs:
automerge:
name: Enable automerge on dependabot PRs
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: github.actor == 'dependabot[bot]'
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using if: github.actor == 'dependabot[bot]' can skip the job on manual re-runs (the actor becomes the human who re-ran the workflow). For pull_request_target, it's more reliable to gate on the PR author, e.g. github.event.pull_request.user.login, so dependabot PRs can still be re-run safely if needed.

Suggested change
if: github.actor == 'dependabot[bot]'
if: github.event.pull_request.user.login == 'dependabot[bot]'

Copilot uses AI. Check for mistakes.
steps:
- run: gh pr review ${{ github.event.pull_request.html_url }} --approve
Comment on lines +16 to +17
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow attempts to enable auto-merge before approving the PR (gh pr merge ... --auto runs before gh pr review --approve). If branch protection requires an approval, the merge command will fail and auto-merge won't be enabled. Swap the order so the approval happens first, then enable auto-merge.

Copilot uses AI. Check for mistakes.
- run: gh pr merge ${{ github.event.pull_request.html_url }} --auto --squash
env:
GH_TOKEN: ${{ github.token }}
Loading