How to apply branches-ignore and paths-ignore on GitHub Actions? For example, if I have the following source tree:
|-src\
|----reports\
|-------<foo>DailyReports.ts
I want to only deploy that to production (master branch) but NOT staging (staging branch).
Any advice and insight is appreciated.
You won't be able to achieve what you want with
ONtrigger configuration alone. Therefore the implementation below wouldn't work as it would trigger for push to the specified pathORfor push to the master branch, but not only for both:In that case, you could do it by using only one trigger at the workflow level, and check the other condition with an
IFexpression.For example by doing this:
Or by checking the branch at the workflow level, and then use something like this path-filter action to check if the file or directory has been updated or not before performing some operation.
I personally suggest the first option (cf example), as it's less verbose.
Note: If the
src/reports/*DailyReports.tspath isn't working as expected, you can use the filter pattern cheat sheet to find the right expression.