Why is CIRCLE_PR_NUMBER empty?

The CIRCLE_PR_NUMBER variable is only available on forked Pull Requests, we note that here:

https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables

However, CIRCLE_PULL_REQUEST should be populated on any build associated with any pull request. You can then use the following to extract out just the PR number:

${CIRCLE_PULL_REQUEST##*/}

This would take the value which is normally something like:

https://github.com/org/project/pull/1728

And turn it simply to:

1728
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.