Now that support for pull requests has been added in Bamboo 6, I'm interested in closing the loop with a Bitbucket pull request by letting my Bamboo build post comments back into the PR. I'd like to use this to automate some aspects of code review using tools like Danger.
I've been able to successfully set up my Bamboo plan to be triggered when a pull request is created in Bitbucket. My next step is to post comments back into the PR using the Bitbucket API. I'll need at least three bits of info
- The repo's project key on Bitbucket
- The repo's slug on Bitbucket
- The pull request's identifier on Bitbucket
The project key and slug can be parsed out of info that is already available to the build. For example, the bamboo.planRepository.<position>.repositoryUrl variable.
What I don't see is a way to get the pull request's identifier. Is there a variable or setting that I'm missing that makes this identifier available to the tasks during a Bamboo build?
I've looked at the other variables listed in Bamboo's documentation and also looked at the environment variables available during my task's execution using the printenv command in a Script task.