Hey,
im trying to build a customized “only build PR branches”. This is my config so far
version: 2.1
jobs:
build:
parameters:
should_build:
type: string
default: ""
steps:
- when:
condition: << parameters.should_build >>
steps:
- do the building here
- unless:
condition: << parameters.should_build >>
steps:
- run: echo "skipping non PR feature branch"
workflows:
version: 2.1
features:
jobs:
- build:
should_build: "$CIRCLE_PULL_REQUEST"
It seems the variable $CIRCLE_PULL_REQUEST is not properly interpolated in the parameters and is always true. I guess its because the config is processed before the parameter injection happens? If i comment the should_build parameter in the workflow job section, it works as expected.
The usecase for is that we have multiple default branches and cant use the “Only Build PR” Switch in the Project settings.