Fix Dependabot auto-merge workflow to retry on approvals and CI completions#327
Fix Dependabot auto-merge workflow to retry on approvals and CI completions#327
Conversation
|
@phlexbot format |
|
No automatic markdownlint fixes were necessary. |
|
Automatic cmake-format fixes pushed (commit 5b66f2a). |
|
No automatic jsonnetfmt fixes were necessary. |
|
No automatic clang-format fixes were necessary. |
There was a problem hiding this comment.
Pull request overview
This PR fixes the Dependabot auto-merge workflow to retry enabling auto-merge when branch protection requirements are satisfied. The workflow previously only triggered on pull_request events and failed when requirements (approvals, CI checks) weren't yet met. It also includes minor CMake formatting improvements.
Changes:
- Added
pull_request_reviewandcheck_suiteevent triggers to retry after approvals and CI completions - Implemented robust error handling to gracefully handle expected failures when requirements aren't met
- Added PR details validation for
check_suiteevents to ensure proper Dependabot PR identification - Applied gersemi CMake formatting to consolidate multi-line
REGEX REPLACEcommands
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/dependabot-auto-merge.yaml |
Added retry triggers (pull_request_review, check_suite), PR validation for check_suite events, and error handling for expected failure cases |
Modules/private/CreateCoverageTargets.cmake |
Formatting: consolidated multi-line REGEX REPLACE to single line (lines 267-268, 445-446) |
Modules/Findjsonnet.cmake |
Formatting: consolidated multi-line REGEX REPLACE to single line (lines 10-11, 53-54) |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #327 +/- ##
==========================================
+ Coverage 80.20% 80.23% +0.03%
==========================================
Files 127 127
Lines 3102 3102
Branches 547 547
==========================================
+ Hits 2488 2489 +1
Misses 386 386
+ Partials 228 227 -1
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
- Add triggers: pull_request_review and check_suite (completed) - Add PR details extraction step for all event types - Add conditional logic to verify Dependabot PRs targeting main - Add error handling for "already enabled" and "not authorized" cases - Pass actionlint validation Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
- Add validation for PR number from check_suite events - Add explicit --repo parameter to gh CLI commands - Use more specific error patterns (branch protection, required checks, required approval) - Improve error message clarity Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
…r handling - Add check_suite condition: verify head_branch starts with 'dependabot/' - Improve error pattern matching to be more specific and case-insensitive - Add detailed comments explaining error pattern matching necessity - Make error messages clearer for debugging Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
- Add regex check to ensure PR_NUMBER is a valid positive integer - Improve error message to show the invalid value Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
5b66f2a to
cb2bcd7
Compare
The workflow only triggered on
pull_request, attempting to enable auto-merge before branch protection requirements were met. It never retried after approvals or CI checks completed.Changes
Event triggers
pull_request_reviewto retry after approvalscheck_suite(completed) to retry after CI checksFiltering for check_suite events
dependabot/gh pr view, confirm author isdependabot[bot]and base ismainError handling
Gracefully handles:
Result
Auto-merge enables automatically once all branch protection requirements are met, regardless of when they complete.
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.