Dispatch merge queue cancellation separately#29441
Conversation
53cbccd to
8410832
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts the merge-queue cancellation mechanism so that cancellation is performed by a separate workflow, allowing the original failing job in the merge-queue “ci” workflow to remain concluded as failed (instead of being finalized as cancelled).
Changes:
- Replaced in-workflow
gh run cancelcalls with a shared.github/bin/cancel-merge-queue.shdispatcher script. - Added a dedicated
cancel-merge-queue-workflowworkflow that waits until GitHub records a failed job, then cancels the run. - Centralized the cancellation request message formatting and dispatch logic.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
.github/workflows/ci.yml |
Routes merge-group failure-triggered cancellation through a shared dispatcher script. |
.github/workflows/cancel-merge-queue-workflow.yml |
New workflow that waits for failure to be recorded before cancelling the originating run. |
.github/bin/cancel-merge-queue.sh |
New helper script that dispatches the cancellation workflow with run metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8410832 to
479e170
Compare
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis PR refactors merge queue cancellation across the CI pipeline from scattered inline logic into a centralized, reusable mechanism. A new dispatcher script ( Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/bin/cancel-merge-queue-workflow.sh (1)
5-5: ⚡ Quick winConsider validating the required argument.
The script doesn't validate that the failure name argument was provided. While all current call sites provide it, adding a check would improve robustness and provide a clearer error message if called incorrectly in the future.
🛡️ Suggested validation
+if [[ $# -lt 1 ]]; then + echo "::error::Usage: $0 <failure-name>" + exit 1 +fi name="$1"🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/bin/cancel-merge-queue-workflow.sh at line 5, Add validation after the name="$1" assignment to ensure the required argument is provided: check if the variable name (name) is empty or unset, and if so print a clear error/usage message to stderr and exit with a non-zero status. Update the script to perform this guard before proceeding with any further logic that uses name so callers get a helpful error when the argument is missing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/bin/cancel-merge-queue-workflow.sh:
- Line 5: Add validation after the name="$1" assignment to ensure the required
argument is provided: check if the variable name (name) is empty or unset, and
if so print a clear error/usage message to stderr and exit with a non-zero
status. Update the script to perform this guard before proceeding with any
further logic that uses name so callers get a helpful error when the argument is
missing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b78a90f1-35f5-4b46-942f-e969771aa9a4
📒 Files selected for processing (3)
.github/bin/cancel-merge-queue-workflow.sh.github/workflows/cancel-merge-queue-workflow.yml.github/workflows/ci.yml
479e170 to
563cb97
Compare
Cancel the merge queue workflow from a separate workflow so that the originally failing job in the merge queue workflow shows as "failed" instead of "cancelled". This makes it easier to tell which one failed.
Release notes
(x) This is not user-visible or is docs only, and no release notes are required.