ci(dependabot): automate merge flow for dependency PRs (#201)#202
Conversation
The refresh-open-prs job previously only called updateBranch. PRs opened before this workflow existed, or PRs where the enable-auto-merge job failed transiently, would be refreshed but auto-merge would never be enabled for them. Add enablePullRequestAutoMerge to the refresh loop so a workflow_dispatch or any push to dev fully recovers stuck PRs. Failures are core.warning (not throw) — branch refresh remains the primary purpose. Closes #201 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
There was a problem hiding this comment.
Pull request overview
Adds a dedicated GitHub Actions workflow to automatically enable and re-assert auto-merge for Dependabot PRs targeting dev, and to refresh Dependabot PR branches when dev advances so they can reach a green/mergeable state without manual intervention.
Changes:
- Introduces
dependabot-auto-merge.ymlwith apull_request_targetjob to enable auto-merge on eligible Dependabot PRs. - Adds a
push-triggered job to update/refresh open Dependabot PR branches afterdevmoves forward and re-enable auto-merge.
|
|
||
| steps: | ||
| - name: Enable auto-merge | ||
| uses: actions/github-script@v8 |
There was a problem hiding this comment.
This workflow uses actions/github-script@v8, but other repo workflows are already on actions/github-script@v9. Bumping to the same major version keeps action security fixes and behavior consistent across workflows.
| uses: actions/github-script@v8 | |
| uses: actions/github-script@v9 |
| - name: Update open Dependabot PRs | ||
| uses: actions/github-script@v8 | ||
| with: |
There was a problem hiding this comment.
This workflow uses actions/github-script@v8, but other repo workflows are already on actions/github-script@v9. Bumping to the same major version keeps action security fixes and behavior consistent across workflows.
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
There was a problem hiding this comment.
Workflow-level permissions grant contents: write and pull-requests: write for all triggers (including pull_request_target). To reduce blast radius, consider setting default permissions to read-only and granting write permissions at the job level only where needed (e.g., enable-auto-merge likely only needs pull-requests: write).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## sprint/12-xunit-v3-apphost-tests #202 +/- ##
=================================================================
Coverage 78.64% 78.64%
=================================================================
Files 43 43
Lines 721 721
Branches 112 112
=================================================================
Hits 567 567
Misses 108 108
Partials 46 46 🚀 New features to boost your workflow:
|
|
🔄 CHANGES_REQUESTED — Routing fix cycle Ralph pre-review gate found one substantive workflow issue to fix before final review approval:
Accepted fix path: set Note: the review concern about Routed to: Boromir (DevOps / Infra) |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Fix pushed in
|
| - name: Update open Dependabot PRs | ||
| uses: actions/github-script@v8 | ||
| with: |
There was a problem hiding this comment.
This step also uses actions/github-script@v8; the repo standardizes on actions/github-script@v9. Please bump to v9 for consistency across workflows.
| if (message.includes('already enabled')) { | ||
| core.info(`Auto-merge is already enabled for PR #${pullNumber}.`); |
There was a problem hiding this comment.
In enable-auto-merge, the catch block only handles the "already enabled" case; all other GraphQL errors will fail the workflow run and leave a red check on the PR. Consider treating expected/non-actionable states (e.g., temporarily not mergeable / branch behind) as info/warning and exiting cleanly (similar to the refresh job) so this automation doesn’t create noisy failures.
| if (message.includes('already enabled')) { | |
| core.info(`Auto-merge is already enabled for PR #${pullNumber}.`); | |
| const normalizedMessage = message.toLowerCase(); | |
| const nonActionableStates = [ | |
| { | |
| match: 'already enabled', | |
| log: () => core.info(`Auto-merge is already enabled for PR #${pullNumber}.`), | |
| }, | |
| { | |
| match: 'not in the correct state to enable auto-merge', | |
| log: () => | |
| core.warning( | |
| `Auto-merge cannot be enabled for PR #${pullNumber} yet because the PR is not currently mergeable.` | |
| ), | |
| }, | |
| { | |
| match: 'pull request is in clean status', | |
| log: () => | |
| core.warning( | |
| `Auto-merge cannot be enabled for PR #${pullNumber} yet because the branch is not up to date or merge requirements are still pending.` | |
| ), | |
| }, | |
| { | |
| match: 'head branch was modified', | |
| log: () => | |
| core.warning( | |
| `Auto-merge could not be enabled for PR #${pullNumber} because the head branch changed during evaluation.` | |
| ), | |
| }, | |
| { | |
| match: 'base branch was modified', | |
| log: () => | |
| core.warning( | |
| `Auto-merge could not be enabled for PR #${pullNumber} because the base branch changed during evaluation.` | |
| ), | |
| }, | |
| { | |
| match: 'is behind the base branch', | |
| log: () => | |
| core.warning( | |
| `Auto-merge cannot be enabled for PR #${pullNumber} yet because the branch is behind the base branch.` | |
| ), | |
| }, | |
| { | |
| match: 'required status check', | |
| log: () => | |
| core.warning( | |
| `Auto-merge cannot be enabled for PR #${pullNumber} yet because required status checks have not completed successfully.` | |
| ), | |
| }, | |
| ]; | |
| const handledState = nonActionableStates.find(({ match }) => | |
| normalizedMessage.includes(match) | |
| ); | |
| if (handledState) { | |
| handledState.log(); |
- promote Sprint 12 from sprint/12-xunit-v3-apphost-tests into dev - add the Dependabot auto-merge workflow validated in PR #202 - complete Sprint 12 milestone closeout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #201
Changes
devdevadvances and re-assert auto-mergeTesting
Checklist