Hi @JPGR94, welcome to Discuss!
You can get close to what you are looking for with advanced conditional logic – I say ‘close’ since the job will still run, but the actual steps you want isolated to the specific branch will only run on that branch.
As an example (note: you have to have at least one step outside the when
condition, hence my note above about it being ‘close’):
version: 2.1
jobs:
job-1:
docker:
- image: cimg/base:stable
steps:
- run: echo "at least one step"
- when:
condition:
equal: [ default, << pipeline.git.branch >> ]
steps:
- run: echo "I am on default"
- checkout
job-2:
docker:
- image: cimg/base:stable
steps:
- checkout
- run: echo "always runs"
workflows:
run-jobs:
jobs:
- job-1
- job-2
With the above setup both jobs will always run, however the - checkout
and - run: echo "I am on default"
steps for job-1
will only ever trigger when the branch is default
.
I also wrote this support article that details the advanced logic a bit more, you may get some more ideas there.
I hope that helps and please let me know if you need anything else!