3

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.)

2
  • You can't achieve what you want using the on field alone (except if you use more than one workflow file). 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, you could check if you want to perform the update or not in further steps/jobs. All in the same workflow file.
    – GuiFalourd
    Dec 27, 2021 at 0:39
  • 1
    Ok, thanks. If you put it as an answer, I can accept it :)
    – Koen
    Dec 27, 2021 at 7:28

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.