Home > Software design >  GitHub Actions. In which branch should the workflow files be located?
GitHub Actions. In which branch should the workflow files be located?

Time:12-08

I have 2 branches: main (default) and dev.

In the test branch I have the following workflow file:

on:
  push:    
    branches: [ test ]

...

There is no such file in the main branch.

When trying to push into the test branch, my workflow does not react in any way.

Where and why should this file be located? What if the same file is located in several branches?

CodePudding user response:

When trying to push into the test branch, my workflow does not react in any way.

The workflow file you mention in dev should be in the test branch first, in order for said workflow to be triggered.

See also "How to run different Github Actions for the different git branches" from Ismail Yenigül:

You can create different .yml files under the repo/.github/workflows directory for each different branch you want to enable GitHub actions.

  • Related