Fix block-remove-before-merge workflow failing on merge_group events#1798
Merged
Conversation
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix block-remove-before-merge workflow failure on merge_group events
Fix block-remove-before-merge workflow failing on merge_group events
Jun 25, 2026
edburns
approved these changes
Jun 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents the “Block remove-before-merge paths” workflow from failing on merge_group events by skipping the job when the event payload does not include a PR number. This avoids unconditional 404s from the gh api repos/$REPO/pulls/$PR_NUMBER/files call while keeping the enforcement intact for normal PR activity.
Changes:
- Add a job-level
ifguard so the check runs only forpull_requestevents. - Ensure
merge_groupworkflow runs are treated as passing by skipping the job rather than failing on missing PR context.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/block-remove-before-merge.yml |
Adds a job-level condition to skip the PR-files check on non-PR events (notably merge_group). |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
rotationtv1-crypto
left a comment
There was a problem hiding this comment.
copilot/fix-block-remove-before-merge-workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On
merge_groupevents,github.event.pull_request.numberis empty, causinggh api repos/$REPO/pulls//filesto 404 and fail the job unconditionally — regardless of whether anyremove-before-mergedirectories exist. This is latent today (merge queue not enabled), but would block every merge queue entry if it were.Change
Added a job-level condition to skip the check on non-PR events:
The check remains fully effective on
pull_requestevents. Onmerge_groupevents the job skips (treated as passing by GitHub's required-status-check logic), which is correct — a PR must have already passed the check before entering the queue.