Must a YAML file that utilizes workflow_dispatch be in all branches that would use it? #171167
-
Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Workflow Configuration Discussion DetailsLast week we were trying to deploy from different branches, but it didn't work. We have 6 .yml files. When we tried to run them none of the even produced a log in the GitHub Actions. I believe the problem is that early in the workflows they all check to see if they're running from either the Development, UAT, or Production branches. And we were trying to run it in Master. I believe we will have to specify Master as a valid branch to run from. Is that correct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Your workflows didn’t run because the on: section in each .yml file only allows triggers from the Development, UAT, or Production branches, so when you pushed to master, nothing was triggered and no logs appeared; to fix this, you’ll need to add master to the list of branches under on.push.branches, or adjust the conditions so the workflows run from master (or any branch you choose) without unintentionally deploying from branches where you don’t want deployments. |
Beta Was this translation helpful? Give feedback.
You don’t need all the YAML files to be identical, but the conditions inside each workflow (like your
if:check) must explicitly allow the branch you want to trigger from. Right now,masterisn’t included anywhere, so those workflows will just skip.If you want
masterto behave like the other branches, you’ll need to do two things:masterto theon:trigger (forpush,pull_request, orworkflow_dispatchas needed).if:condition to also check formaster, or adjust the logic so it runs whenever you need it to.The workflows don’t have to be identical across branches, but they do need to reference the branch you’re running from, otherwise nothing will happen.