Is there a syntax to define a job to run only if some files change comparing to last commit?
There is, you can use
on.<push|pull_request>.paths syntax for that. E.g. to run only on pushes that changed
on: push: paths: - 'example.c'
You can use globs.
Thanks for your reply!
on.<push|pull_request>.paths can only make a workflow to run when some designated files change, but not a job. I wonder if there is a way to to only run specific jobs when some files change within a workflow.
You could set job level outputs in a previous job A. Use git command to check whether file changed during the workflow run. And then if file changed , you could set an output variable to true using ```
Also please add needs : [ jobA ] in next jobs , add job if conditional, if the output variable is true then run these jobs.
There is the syntax for