Skip to content

block-remove-before-merge workflow fails on merge_group events (latent merge-queue blocker) #1797

Description

@SteveSandersonMS

Summary

The block-remove-before-merge.yml workflow (added in #1729, merge commit 079c558) is triggered on merge_group events but cannot work on them, and will fail the run — which would jam the merge queue if/when it's enabled.

Details

The workflow triggers on both pull_request and merge_group:

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
  merge_group:

But it derives the PR number from the pull_request context, which is empty on merge_group events:

PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
  FILES=$(gh api repos/$REPO/pulls/$PR_NUMBER/files --paginate --jq '.[].filename')

On a merge_group event PR_NUMBER is empty, so the call becomes gh api repos/$REPO/pulls//files, which 404s. GitHub Actions runs run: blocks with set -eo pipefail, so the failed command substitution fails the step.

Impact

Currently dormant — the merge queue is not enabled (every run of this workflow so far is a pull_request event; there are no merge_group runs). So this does not break anything today. It is a latent issue: whoever enables the merge queue later will see every merge-queue run fail with a confusing, seemingly-unrelated error.

Suggested fix

The check is inherently PR-scoped, so it should not do its work on merge_group. Either:

  • Remove the merge_group: trigger, or

  • Skip the job on non-PR events:

    jobs:
      check-paths:
        if: github.event_name == 'pull_request'

If this is intended to be a required status check under a future merge queue, instead short-circuit to success on merge_group (so the queue still sees a green check) rather than skipping the job.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions