I read the docs at https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-shell-command and I wanted to use the $CIRCLE_PR_NUMBER environment variable but it doesn’t seem to work.
test-env:
machine: true
working_directory: ~/repo
steps:
- run:
name: 'Setup env variables'
command: |
echo 'export MY_PR_NUMBER="$CIRCLE_PR_NUMBER"' >> $BASH_ENV
echo 'export MY_PR_NUMBER2=${CIRCLE_PULL_REQUEST##*/}' >> $BASH_ENV
echo 'export MY_PR="$CIRCLE_PULL_REQUEST"' >> $BASH_ENV
- run:
name: 'What PR am I on?'
command: echo $MY_PR
- run:
name: 'What is my PR number?'
command: echo $MY_PR_NUMBER
- run:
name: 'What is my PR number2?'
command: echo $MY_PR_NUMBER2
The one for MY_PR_NUMBER does not output anything. I used a workaround from another thread 2 years ago to get the PR number.
Is this a bug?