I am experiencing issues on some builds because the environment variable CIRCLE_PULL_REQUEST(S) are not being set.
The builds are being triggered by commits to the branch where the changes are being accumulated (not the target branch of the PR). I am using Github.

I have a bash script checking specifically for this environment variable and executing custom logic based on it.

if [[ ! -z $CIRCLE_PULL_REQUEST ]]; then
  # execute ui tests

The logic is pretty trivial and basically executes UI tests or not, based on the presence of the variable.
Today, I had to manually rebuild a job 5 times for the environment variable to be set in the container.

Any clues?


I am also having this issue- sometimes CIRCLE_PULL_REQUEST isn’t set. We use the pull request number for build artifacts.

This is also seems to be effecting CI_PULL_REQUEST.


@seveibar correct.

All four environment variables are missing at the same time



We have been experimenting a little bit more with more builds, and apparently, triggering the build manually with the “Rebuild” button on the top right does set the correct PR environment variables.



I can confirm. Having the same issue.


Thanks for reporting this everyone. We’ve merged some changes that should fix the issue.

I just ran a test build on a branch with an open PR and the env vars were populated correctly:

Do let us know if it’s still not resolved for you.


Hello @tom,

This problem still occurs.

Sometimes CIRCLE_PULL_REQUEST environment variable are set.

I do not know the reproduction condition.
Two containers are executed in parallel by CircleCI Workflow, but this happens frequently in containers using alpine images.



This issue occurred again in another repository.
Workflow and alpine image had nothing to do with the issue.


We are experiencing the same issue. Sometimes rebuilding will fix this.


Same thing for us. Sometimes the variable is not set and therefor our tests are not running


Thanks for checking and getting back to us. Our engineers are still looking into this, and we’ve been able to reproduce it inconsistently. Our working theory right now is that this is a race condition between two Github hooks, one for a push and one for a PR commit. We’ve been able to reproduce this using a commit from the Github PR web UI, so it’s not a simple matter of “create a PR then push to it”.

For now, rebuilding is the only suggestion I have while our engineers look into this further.


Any updates on this? We heavily use the environment variable for a ton of automation we do. Having to rebuild a PR so often is kind of disheartening :frowning:


Seeing this too. Hopefully someone can provide a fix for this soon.


We’re also seeing it. Since the “Only build pull requests” is locked to the default branch on git we rely on this env var to reimplement this feature as we have more than one release branch where we need to run builds on all commits.

We can at the same time not run builds on commits on branches that isn’t a PR yet.

If this can’t be resolved we’ll be forced to switch to another CI provider



seeing the same behavior at the moment.

The product should generally perform better with executing jobs around the moment a pull request is created, because a lot of QA work should be done at that moment.

I’ve seen issues mentioning this very often, but no one from the team mentioned how the direction for that feature will be.

Kind regards,



We have rolled out a fix. Please let us know if you are still experiencing this issue. Thank you so much for your patience.


Same for java circleci/openjdk:8-jdk and circleci/openjdk:9-jdk images

The following environment variables are not set:


Sorry to hear that. Can you please DM the build link where you are experiencing this issue? Thanks!


Still seeing the same issue, none of the PR variables are being set.


I am having the same issue.
One example would be:

I am printing the PR# as
println “GitHub PR is #${System.env.CIRCLE_PR_NUMBER}”

The result is
GitHub PR is #null