Expose GitHub Pull Request link in environment variable

Description of the feature request

It’d be nice to easily link to pull requests on Slack messages. Currently the environment variables provided by bitrise aren’t sufficient for this use case.

Use case / for what or how I would use it

$BITRISE_GITHUB_PULL_REQUEST would contain the full path to the pull request. I’d use it in a Slack message step.

Example: https://github.com/TestArmada/flank/pull/152

Here’s our current work around:

- slack:
        is_always_run: true
        run_if: ".IsBuildFailed"
        - webhook_url: https://hooks.slack.com/<removed>
        - buttons: |
            View Build|${BITRISE_BUILD_URL}
            GitHub PR|https://github.com/instructure/instructure-android/pull/${BITRISE_PULL_REQUEST}

Good idea, just wondering how this should be done, as the PR URL is service dependent, it’s different on github, bitbucket, gitlab, …

Maybe this should be done via a step, using the repo URL & the PR ID? :thinking:

Maybe one ENV var per service?


Sure, that can work, although Steps would be easier to change/update or even extend for other services :thinking:

If we’d go with env vars, then I’d probably vote for NON service branded env var, e.g. PULL_REQUEST_URL or similar, as the purpose of this env var is expected to be the same for all services, most likely. wdyt?

1 Like

Maybe try a GITHUB step first and see what happens. I agree that seems to better align with the overall Bitrise vision.

1 Like

I agree - will bring up for a discussion with the team!

@viktorbenei Any update on this?