We don’t have a way to do that natively with GitHub Actions – sorry about that!
There is a workaround but it involves some manual computation.
In this computation, determine if the relevant paths were changed, if not, you can return
exit 0 to communicate that it was a successful run.
If the relevant path did change, then they would need to process it accordingly and return the intended exit code so that it “bubbles up” in the form of a check run status.
This is a rough guide on how the computation would look like:
- Configure the workflow to trigger for a
- In one of the job steps, fetch the pull request’s files from the API using the
- The result is an array, each element an object with a
filename field. Map the results for just the
- In the newly filtered results, check to see if any of the files contain any of the relevant paths. If at least one matches, then do whatever tests you need to do in the next steps. If none match, then this is where you can communicate “done” with an
exit 0 since no further processing needs to happen.