-
Here’s my setup: folder structure
Workflow simple example I’d like to accomplish
I want a list of jobs to execute only for subdirectories that have commits. Any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
IMO, your best path here is to have a previous job figuring out where the changes are, then setting the output and using that output to build your matrix job. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
brightran:
I don’t think the paths filter is enough. If I make a change to repo > subdir > env1 contents then I want a job that will only, for instance, have a step |
Beta Was this translation helpful? Give feedback.
-
Not a bad idea, thanks. I wish there were a canned solution already. Really I’m just trying to work around the fact that GitHub doesn’t have templating yet. I have 20+ workflows that are exactly the same except they trigger based on different paths getting updated and I was hoping to condense it down to 1 workflow with a matrix strategy. |
Beta Was this translation helpful? Give feedback.
-
You can use “git diff” command to list all the changed files, and then check if all the changed files are under the directory “subdir/env1”. If all the changed files are under that directory, set an output with the value is true, otherwise false. Then according to the value of the output to run or not run the subsequent job which has the step echo “Updates made to env1”.
|
Beta Was this translation helpful? Give feedback.
@heathsnow,
You can use “git diff” command to list all the changed files, and then check if all the changed files are under the directory “subdir/env1”. If all the changed files are under that directory, set an output with the value is true, otherwise false. Then according to the value of the output to run or not run the subsequent job which has the step echo “Updates made to env1”.
A simple example: