Skip to content

Support merge queue#255

Merged
saschabratton merged 4 commits intodorny:masterfrom
masaru-iritani:support-merge-group
Mar 14, 2026
Merged

Support merge queue#255
saschabratton merged 4 commits intodorny:masterfrom
masaru-iritani:support-merge-group

Conversation

@masaru-iritani
Copy link
Copy Markdown
Contributor

I'll publish this pull request once confirmed it's good to go by maintainers.

What

This pull request adds a support for merge_group event.

Why

Closes #183
Closes #253

Some repositories (including my organization's one) enable the merge queue, where pull requests are queued to be checked sequentially. It's common (I believe) to use the same test workflow for both pull_request event and merge_group event, which is triggered when a change gets into or out of the merge queue.

Currently, paths-filter action doesn't do anything special for detecting the base commit for a commit in the merge queue. Therefore, if the merge queue has multiple pull requests, the diff may include changes from other pull requests and cause false-positives.

Specifying the base and ref explicitly from the merge_group event (as shown in #183) can workaround the problem. But it'd be great if paths-filter can handle them by default.

This change won't break existing workflows already specifying ref and base explicitly because manual inputs take precedence over commit hashes from the event (unlike pull_request events where manual inputs are ignored).

@masaru-iritani masaru-iritani changed the title Detect commit hashes from merge_group event Support merge queue Dec 18, 2024
Comment thread src/main.ts Outdated
@masaru-iritani masaru-iritani marked this pull request as ready for review February 8, 2025 08:13
@efenderbosch-atg
Copy link
Copy Markdown

In the meantime, we are trying this setup for merge queues:

      - name: Find Changes
        uses: dorny/paths-filter@v3
        id: find_changes
        with:
          # For merge group events, compare against the target branch (main)
          base: ${{ github.event_name == 'merge_group' && github.event.merge_group.base_ref || '' }}
          # For merge group events, use the merge group head ref
          ref: ${{ github.event_name == 'merge_group' && github.event.merge_group.head_sha || github.ref }}

Co-authored-by: Masaru Iritani <25241373+masaru-iritani@users.noreply.github.com>
@saschabratton
Copy link
Copy Markdown
Collaborator

@masaru-iritani lgtm. We should add this. Do you want to commit the build?

@masaru-iritani
Copy link
Copy Markdown
Contributor Author

@saschabratton Thank you for taking a look! I realized my previous suggestion to match the type of pull request-related events wasn’t quite right. I pushed another commit that corrects it by keeping the existing behavior and updating the type annotation. If it looks good to you, I’d appreciate it if you could merge this pull request.

@saschabratton
Copy link
Copy Markdown
Collaborator

@masaru-iritani I think it's fine either way. It's only referencing .number which is the same on both. But yes, correcting the type being cast instead of the assignment works just as well.

You just need to build the dist and we can merge this 👍🏻

@masaru-iritani
Copy link
Copy Markdown
Contributor Author

@saschabratton I executed npm run pack and pushed a commit with the diff. Please let me know if I should have done anything differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use alongside github merge queues Document usage in a merge queue

3 participants