workflows must be defined on master?


I’m sure there’s a bit of documentation I’m not finding…

Must workflows (.github/workflows/my_workflow.yml) be defined _and_ committed on master for them to work?

The case I’m thinking about here is having a slightly different workflow on master and say a release-x.y branch. If I start with a workflow on master, and later edit it on the release branch, what will get used? The version on master or the version on the release branch? The way the UI is structured suggests the answer is “the version on master”, but I cannot find a piece of documentation that says this.

On the same line, if I open a PR that modifes the workflow and the target branch is master, what will run? The unmodified version already on master or the modified version in the PR? If the former, how do I test that the change in the workflow is not breaking the workflow?


No, a workflow can exist in any branch. It will be triggered as long as your conditions (the “on” block) matches.

If you open a PR with a modified workflow, all workflows that are on the “pull_request” or “push” (without target branch) condition will run based on the code from that PR/push, so with the updated workflow.

Thanks! I was confused because in the UI on the screen listing the workflows that have run, there’s a menu on the right of each item that contains an option “view workflow file”, and that’s showing me the version from master.

Double checking, I can verify that the version that actually ran is the one from the branch.