# Pull Request Environment Variables

**URL:** <https://discuss.circleci.com/t/pull-request-environment-variables/25255>\
**Category:** Build Environment\
**Created:** [September 19, 2018, 4:00pm UTC](https://discuss.circleci.com/t/pull-request-environment-variables/25255 "2018-09-19T16:00:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vonnagy](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/vonnagy/32/19205_2.png) [@vonnagy](https://discuss.circleci.com/u/vonnagy)\
**Post date:** [September 19, 2018, 4:00pm UTC](https://discuss.circleci.com/t/pull-request-environment-variables/25255/1 "2018-09-19T16:00:08Z")

</div>

We are trying to determine if individual builds are started based on a PR. In the CircleCI UI, we can see that the build is associated with a PR, but none of the PR environment variables are present (e.g. CIRCLE\_PULL\_REQUEST, CIRCLE\_PR\_NUMBER, etc…). We have setup a workflow with multiple stages and would like to filter some jobs/stages base on if it is a PR build.

Is there some setting in CircleCI or GitHub that I need to set in order for these values to be included in the CircleCI environment variables?

![45%20AM](https://global.discourse-cdn.com/circleci/original/3X/b/e/beeedbb9583b1bca2e63e1df474dbd59e7b2741a.png)

In the example above, it should have a `CIRCLE_PR_NUMBER=4` and a valid PR URL in `CIRCLE_PULL_REQUEST`.

---

<div class="post-metadata">

**Author:** ![Sara](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/sara/32/9781_2.png) [@Sara](https://discuss.circleci.com/u/Sara)\
**Post date:** [September 24, 2018, 8:36pm UTC](https://discuss.circleci.com/t/pull-request-environment-variables/25255/2 "2018-09-24T20:36:44Z")

</div>

Hi @vonnagy The `CIRCLE_PR_NUMBER` is only available for forked PRs. More on this can be found on the [Built-in Environment Variables](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) documentation.

The `CIRCLE_PULL_REQUEST` url should be present on commits after the PR is opened.

For example, if there is a commit that is built on CircleCI, then the PR opened afterwards, the url will not be present. However, every subsequent commit to the PR will have the `CIRCLE_PULL_REQUEST` url present.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [December 23, 2018, 8:36pm UTC](https://discuss.circleci.com/t/pull-request-environment-variables/25255/3 "2018-12-23T20:36:49Z")

</div>

Closed on December 23, 2018, 8:36pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
