$CIRCLE_PULL_REQUEST is missing from my Pull Request

When you first publish your commit to your VCS, the webhook will fire and CircleCi will download your code and run your project. Later when you create the pull request, a new commit ID is generated and you might expect this to run on CircleCi again, but it will not.

 

We do not run code twice that hasn't been modified to save you time, resources, and money. If the tests have already passed, there is no reason to test the code again. What will happen is the original job ran on your account will be updated to show that it is now a pull request.

 

In the original run of the job, before it was a pull request, data such as `$CIRCLE_PULL_REQUEST` will not exist. Then after you create the pull request and the job on CircleCi is updated to reflect that, the data will be present if the job is re-ran.

 

In the `Advanced Settings` page of your project's settings you can enable `Only build pull requests`

 

 

This will only allow commits to `Master` (your default branch), and pull requests to be ran. This will resolve the issue above as the first commit will not be ran, so when the pull request is created it can run properly.

 

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

Comments

0 comments

Please sign in to leave a comment.