Trying to create github actions in another branch else than Main

Trying to create github actions in another branch else than Main.

Is it possible? Or i need to create a new branch, first by creating the workflow with the yaml, than adding all my source codes in it? I tried on a existing branch and won’t.

That depends on the type(s) of event you want the workflow to run on.

Key points from there:

  1. An event occurs on your repository, and the resulting event has an associated commit SHA and Git ref.
  2. The .github/workflows directory in your repository is searched for workflow files at the associated commit SHA or Git ref. The workflow files must be present in that commit SHA or Git ref to be considered.

The documentation lists which git ref and commit SHA are used for each kind of event. For push it’s the just pushed commit (so you can just add a workflow file to a branch and push), for others it’s more complicated, and for some events the workflow file must be on the default branch.

I actually was able to manually create the workflow from point 2 example. Its mostly the first time I try actions and implemanting YML files. Thank you for the help!

1 Like