Pull request number on push

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?

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

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

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

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)
Imprint