Add $BITBUCKET_PULLREQUEST Environment Variable

Issue #14222 closed
Nick Lubisch created an issue

Im planning a simple script which comments my pull-requests with the latest code coverage.
For this i need to know the pull-request id in order to post a comment through Bitbucket API 1.0.

It would be nice if theres an environment variable called "$BITBUCKET_PULLREQUEST" which contains the id of the pull-request. It should only be set if the current build is triggered through an updated pull-request.

Comments (1)

  1. Joshua Tjhin Account Deactivated

    Hi Nick,

    Pipelines currently aren't associated with pull requests and therefore it's a little difficult to provide that variable. However, given that you are already using the Bitbucket API, a workaround is to use the pull request API and check for pull requests that match the variable $BITBUCKET_BRANCH

    URL for list of pull requests

    https://api.bitbucket.org/2.0/repositories/{owner}/{repo}/pullrequests

  2. Log in to comment