Expose GitHub Pull Request link in environment variable

#1

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"
        inputs:
        - 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}
0 Likes

#2

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:

0 Likes

#3

Maybe one ENV var per service?

GITHUB_PR
GITLAB_PR
etc.

0 Likes

#4

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

0 Likes

#5

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

#6

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

1 Like

#7

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

0 Likes

#8

@viktorbenei Any update on this?

0 Likes