# Pull request number on push

**URL:** <https://travis-ci.community/t/pull-request-number-on-push/8177>\
**Category:** Environments\
**Tags:** travis-build\
**Created:** [April 16, 2020, 2:55am UTC](https://travis-ci.community/t/pull-request-number-on-push/8177 "2020-04-16T02:55:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ac427](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/ac427/32/4350_2.png) [@ac427](https://travis-ci.community/u/ac427)\
**Post date:** [April 16, 2020, 2:55am UTC](https://travis-ci.community/t/pull-request-number-on-push/8177/1 "2020-04-16T02:55:33Z")

</div>

I have a script which deletes any old comments in github pr and posts a new comment on any re-runs or forced push or updates to a PR. Basically the comment is stdout of terraform plan.

I don’t see any env which shows github pull number on pushes. is it something that can be added or is there any other way to retrieve it?

> **[Travis CI Documentation](https://docs.travis-ci.com/user/environment-variables/#default-environment-variables)**
>
> Environment Variables

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [April 17, 2020, 2:06am UTC](https://travis-ci.community/t/pull-request-number-on-push/8177/2 "2020-04-17T02:06:04Z")

</div>

Not sure what you mean by “github pull number on pushes”.

If that’s Pull Request number, it’s available as `$TRAVIS_PULL_REQUEST`.

---

<div class="post-metadata">

**Author:** ![ac427](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/ac427/32/4350_2.png) [@ac427](https://travis-ci.community/u/ac427)\
**Post date:** [April 17, 2020, 2:25am UTC](https://travis-ci.community/t/pull-request-number-on-push/8177/3 "2020-04-17T02:25:29Z")

</div>

I’m all set. There are two checks on pr, one is called push and other pr. I just had to skip for push. This is what I did

```auto
if os.environ['TRAVIS_PULL_REQUEST'] == 'false':
    pass
else:
    PULL_META = REPO.get_pull(int(PR))
    ALL_COMMENTS = PULL_META.get_issue_comments()

    for item in ALL_COMMENTS:
        if item.user.login == 'foo':
            item.delete()

    with open('deploy.txt', 'r') as myfile:
        DATA = myfile.read()

    PULL_META.create_issue_comment(DATA)

```
