Rules for locating github actions

I am trying to figure out the rules by which github locates
workflows to show on the left of the Actions page. Specifically:

  1. Is it possible to have different sets of workflows on different branches? My experiments seem to indicate that only workflows on the master branch are used.

  2. Is it the case that whenever I visit the actions page, github looks in .github/workflows and displays all the .yml files there as workflows? Again by experimentation, this does not appear to be the case because I can add a workflow via PR but it does not show up.

  3. Does it matter that the repo in which I am working is a fork of another repo?

I guess this is helpful GitHub actions.

  1. Yes it is possible to have a different set of workflow according to branch.
  2. I can’t understand this. BUT You can add new workflow through PR and it will show in GitHub actions. If its not showing there. Then there might some other isssue.
  1. I guess it doesn’t matter. I can use actions on any repo including fork.

Thanks. I still see problems with workflows on non-master branches.

Also, I saw on stack exchange the claim that a workflow will not show up until its first activation. Is this correct? If so, it seems like a bad idea.

That depends on the event that’s supposed to trigger the workflow, key quote from the documentation (link below):

  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.

If you check the event descriptions on that page the GITHUB_REF describes which branch (or other ref) the event uses.

Thanks for the documentation pointer.

1 Like