Which version of the workflow file does GitHub use for a given run?
IntermediateConceptWorkflow Anatomy & Execution Model
Answer
The file at the commit SHA associated with the event (GITHUB_SHA):
push: the pushed commit, so a branch can modify its own workflow.pull_request: the merge commitrefs/pull/N/merge, so the PR's version of the workflow runs.pull_request_target,workflow_run,schedule,issue_comment: the default branch (base) version.workflow_dispatch: the ref you choose when dispatching.
This is why changing a schedule on a feature branch does nothing until it is merged.
More on Workflow Anatomy & Execution Model
Define workflow, run, job, step, action and runner in one line each.BeginnerWhat is the minimum valid workflow file?BeginnerWhere must workflow files live, and does the file extension matter?BeginnerWhat does a GitHub-hosted runner give you at the start of a job?BeginnerShould you use `ubuntu-latest` or `ubuntu-24.04`?BeginnerWhat runner images and architectures can you choose from?Intermediate