-
We make heavy use of
For scoping Workflows related to some sub-component of our monorepository to only run when code within that component has changed. We find very frequently the Workflows run when we’re not expecting them to. Is there any documentation on exactly how the “changed paths” list that is matched to this glob is computed? From a user’s perspective, I’d expect it to match the list of changed files in the PR diff view at the time of push. Technically speaking, I’d expect it to be:
But we see these scoped Workflows run when there are no matched paths by those approaches. Anecdotally, it seems to be related to syncing from the base branch. When we merge in |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
docs.github.com
Workflow syntax for GitHub Actions - GitHub Docs//docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
(Amusingly, this isn’t an edge I’ve hit much. I do regularly hit the 250 commit limit.)
|
Beta Was this translation helpful? Give feedback.
-
Thanks for finding that! Next time we find unexpected runs, I’ll look to see if this explains it. |
Beta Was this translation helpful? Give feedback.
-
I’m still lost, I have a similar problem. All I want is to run I have my I created a During a cycle, I may change python files in I don’t want all my workflow checks to run unless I change something in two specific folders, say So, whenever I change something in I have this for my
So how can I tweak my |
Beta Was this translation helpful? Give feedback.
-
Well, by the hard way, as usual, I got to understand what @jsoref pointed out. So my So, it’s ok when I do a PR just to fix docs etc., but if I need to add a What I was hoping is that the diff comparison were done per sequential PUSH. Probably there’s a solution for what I wanted. Any hints? |
Beta Was this translation helpful? Give feedback.
-
There are some github actions that probably try to help here. (I’m fairly certain I’ve seen some that will help with this.) A quick search shows:
GitHub - tj-actions/changed-files: Github action to retrieve all (added,...Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files with support for push and pull request events. - GitHub - tj-actions/chang... To make it work would require a bit of magic, since you’d have to fish for the previous head value. I’m fairly certain it’s floating around, in fact, check-spelling has some magic for it:
check-spelling/check-spelling/blob/d3e67e88f93da3534317e3cafc06a387bd7daed3/unknown-words.sh#L963-L980 (I’m not sure you’d really want to try to understand that black magic.) But, the code is there to support this feature:
check-spelling/check-spelling/blob/d3e67e88f93da3534317e3cafc06a387bd7daed3/action.yml#L130-L131 Essentially you’ll be writing a workflow that will run, and it will use run some action to decide which files have changed since the last push, and then the later steps will be skipped. That said… The naive solution is “don’t mix doc changes with code changes unless you want to have testing recheck”. That is a valid approach, although it means you now get 2 PRs, one to add a feature and one to document the feature. |
Beta Was this translation helpful? Give feedback.
docs.github.com
Workflow syntax for GitHub Actions - GitHub Docs
//docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
(Amusingly, this isn’t an edge I’ve hit much. I do regularly hit the 250 commit limit.)