Run job against code on branch B when code is pushed to branch A


I have workflow that has a job(test-job) in it that only runs when a commit is pushed to branch test. Now I also want to run it when a commit is pushed to master but I want the job to execute against code on the branch test and not master.

Example config:

  version: 2
      - test-job:
                - test

Any insight into how I could solve this would be greatly appreciated. I thought about using another job that would be triggered by master push that would kick off the test-job on the test branch via the circleci api but I would prefer to avoid this if possible. I am hoping there is an easier way that I am just missing.

Thank you for your time.

Hi @rmcwilliam ,

You can add your master branch to your branch filters and use logic statements to determine if the current branch is test or master. If the build was triggered from your master brach, you can add a custom checkout step to checkout your test branch.