Action with on: push: [main] and paths config is not triggered when PR is squash and merged, it is working with rebase and merge #179965
-
Why are you starting this discussion?Bug What GitHub Actions topic or product is this about?Workflow Configuration Discussion DetailsI have configured a github action with the following event: on:
push:
branches:
- main
paths:
- 'schemas/**'I was expecting to see the workflow triggered after a PR is merge to main and it contains some modification of a file inside schemas folder. The issue is depending on how the PR is merged the behaviour is differnt:
I found issues related like this one https://github.com/orgs/community/discussions/25812#discussioncomment-4041758, which was closed but it contains comments describing a similar behaviour. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
This behavior is expected due to how squash merges are created. This is a known limitation and has been discussed before. If you need consistent behavior, consider triggering on pull_request with paths, and checking |
Beta Was this translation helpful? Give feedback.
-
|
This is expected behavior due to how GitHub handles path filters on squash merges. When a PR is squashed, the resulting commit is a single new commit that may not match the original path changes individually, so workflows with paths: may not trigger. Currently, there’s no workaround to make paths: fire reliably on squash merges — the workflow will always reliably trigger on Rebase and merge or direct commits. |
Beta Was this translation helpful? Give feedback.
-
|
I spent over an entire's day worth of time chasing ghosts. If you arrive here, please be sure you don't have [skip ci] in your commits... |
Beta Was this translation helpful? Give feedback.
This behavior is expected due to how squash merges are created.
With rebase and merge, GitHub generates real commits on main, so the paths filter works correctly.
With squash and merge, GitHub creates a single new commit and the file-level change metadata isn’t always preserved in a way that triggers paths filters on push.
This is a known limitation and has been discussed before.
If you need consistent behavior, consider triggering on pull_request with paths, and checking
github.event.pull_request.merged == true,or avoid squash merges for workflows that depend on file path filters.