From another answer I know how to run an action if an update is pushed to (a specific path in) a certain branch. The answer also implies how to run an action on any update in a specific branch.
However, what I would like is to trigger an update
- either a push to any file/folder in branch A
- or a push to a specific file in branch B
I have tried the following, but that throws a syntax error (because it seems there can only be one push
entry):
on:
push:
branches:
- translation-files
push:
branches:
- main
paths:
- .github/workflows/translation-updates-to-main-repo.yml
Any idea if such combination would be possible, and if so: how? (If not, I'll probably have to just accept to manually initiate the run in case I update this action workflow.)
CodePudding user response:
You can't achieve what you want using the on
field alone (except if you use more than one workflow file, one for each trigger).
However, you could evaluate the branch ref
and if the specific path has been updated in a job step (there is an interesting path filter action for that). Then, based on the result/output, you could check if you want to perform the update or not in further steps/jobs. All in the same workflow file.