Struggling to skip a single step when a GitHub Fork opens a Pull Request. The gist. I do not want to expose secrets to PR builds, but I want to do everything else. When I accept the PR from the Fork, I want to run the entire build (which includes using secrets for security scanning).
What am I doing wrong?
I’ve used {<<<—} to indicate what I “think” I should be doing but probably doing wrong. More attempts on conditions at the end.
sample config.yml
jobs:
main:
parameters:
image:
type: string
circle_pr_number:
type: string
default: $CIRCLE_PR_NUMBER <<<— I couldn’t figure out how to use the Built-in environment variables in a conditional statement; my hack, Appears that $CIRCLE_PR_NUMBER is a string and not a number.
docker:
- image: <<parameters.image>>
steps:
- checkout
- run: echo <<parameters.circle_pr_number>> <<<--- Outputs the correct value of the PR (e.g., 302)
- unless:
condition:
matches: <<<--- latest attempt was to use a regex
pattern: \d
value: <<parameters.circle_pr_number>>
steps:
- run: echo "condition met"
OTHER ATTEMPTS
condition: <<parameters.circle_pr_number>>
condition:
equals: [ "", <<parameters.circle_pr_number>> ]
condition:
equals: [ 301 , <<parameters.circle_pr_number>> ]