Workflow run in PR branch is using workflow file from the default, base branch

I have noticed that when I’m pushing changes to a branch for an open PR, the workflow that runs is actually using a workflow yaml file from the base branch instead of the one for the PR.

The scenario is as follows:

  • branch out feature/branch from main
  • do your stuff in feature/branch but DON’T modify the workflow file, then open a PR
    • all good 'til this point
  • push changes in the workflow file to main
  • then commit some more stuff to feature/branch(again, not the workflow file) so the PR triggers a new run
    • notice how the NEW main workflow file is being used

Can anybody please confirm I’m not going crazy ? Or is this actually expected ?

Thanks !

The workflow config is like this:

      - main
      - main


I dont understand the problem, the github action take the workflow config from the default branch so seems to works perfectly on your repository :blush:

Hi !

Shouldn’t it take the workflow config from the feature branch the PR is opened with ? And each push to the feature branch trigger a workflow run with the feature branch workflow yaml file ?

Otherwise that would mean that if I change the workflow config file in the feature branch, I would not be able to trigger that workflow config until I merge the feature branch into the base one, which seems odd.

A pull_request runs from the merge of the head and base not just from the head. So if your workflow file changes in main while you have a PR open the next update to the PR will get the changes.

1 Like

That makes perfect sense @chrispat , I wasn’t aware of that(thus why I also have an on: push to main, so it triggers a run after the merge).

Thank you both !

1 Like