As seen in the screenshot, Bitrise has the Pull Request URL within the build page, but it seems this can’t be accessed within a step as none of the available environment variables provide this URL.
Why is there no $BITRISE_PULL_REQUEST_URL environment variable that this is stored in, and can this please be added?
That environment variable only half works though. If the Bitrise app is configured via SSH, then $BITRISEIO_PULL_REQUEST_REPOSITORY_URL returns the SSH git URL, not the HTTPS URL I was pointing out in the screenshot.
I see, thanks for clarifying! I was also incorrect, $BITRISEIO_PULL_REQUEST_REPOSITORY_URL seems to expose a HTTPS URL, but not for the PR but directly for the repo
You should be able to get the URL by attaching the $BITRISE_PULL_REQUEST variable (which exposes the ID) to the end of a line containing the standard URL, but that feels a bit like a workaround.
…but the workaround you suggested only works if the Bitrise app is configured via HTTPS and not by SSH?
If the Bitrise app was configured via SSH, $BITRISEIO_PULL_REQUEST_REPOSITORY_URL returns git@bitbucket.org:<org>/<repo>.git, and appending $BITRISE_PULL_REQUEST to the end of that still won’t give you a usable URL.
It makes no sense that the output environment variable (regardless of HTTPS/SSH configured project) doesn’t output the whole pull request URL, while the build page (below) has no issue working it out and displaying it as you would expect it to…?
Would that work? Admittedly it requires even more configuration if you wanna use this for multiple repos/orgs.
I completely understand the question though, getting the PR URL is done by the website and is git service dependant, the CLI does not expose this at the moment unfortunately.
It’s a decent workaround for myself, however as I now maintain the Microsoft Teams step I was hoping to update the step to provide a direct “Go to Pull Request” button in the Teams message for PR builds, and requiring the user to provide the pull request base URL as another input for it to work is pretty clunky and less than ideal