/
Identifying the required Pull Request parameters from the SCM or CI

Identifying the required Pull Request parameters from the SCM or CI

When reporting a Pull Request to SeaLights, the parameters required to configure the pull request BSID vary between the source control provider.
This article will help you to map the required parameters to their location within the few most common source control or CI providers:

Here is a table summarizing the most common variables in use in the relevant SCM section

Sealights PR Parameter

Jenkins GitHub Pull Request Builder variables

BitBucket env. variables

GitLab env. variables

Generic Git variables

pullRequestNumber

ghprbPullId

BITBUCKET_PR_ID

CI_EXTERNAL_PULL_REQUEST_IID

GIT_PULL_REQUEST

latestCommit

ghprbActualCommit

BITBUCKET_COMMIT

CI_COMMIT_SHA

GIT_COMMIT

repoUrl 

ghprbPullLink

BITBUCKET_REPO_SLUG or BITBUCKET_GIT_HTTP_ORIGIN

CI_REPOSITORY_URL

GIT_REPO_URL

targetBranch

ghprbTargetBranch

BITBUCKET_PR_DESTINATION_BRANCH

CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME

CHANGE_TARGET

For latestCommit parameter, we’re highlighting the short version in the screenshots below but the long/entire SHA identifier needs to be used.

GitHub

If you’re using the GitHub Actions or the GitHub Pull Request Builder plugin for Jenkins, you can use the following mapping to variables suggested below

Sealights PR Parameter

GitHub Actions variables

GitHub PR Builder variables (Jenkins plugin)

Comment

Sealights PR Parameter

GitHub Actions variables

GitHub PR Builder variables (Jenkins plugin)

Comment

pullRequestNumber

github.event.pull_request.number

ghprbPullId

 

latestCommit

github.event.pull_request.head.sha

ghprbActualCommit

 

repoUrl 

$GITHUB_SERVER_URL/$GITHUB_REPOSITORY

ghprbPullLink

Something similar to: https://github.mycompany.com/myappjava/ if the pull request URL is
https://github.mycompany.com/myappjava/pull/8031 in other words everything before word ‘pull’ like shown in the picture above

targetBranch

github.event.pull_request.base.ref

ghprbTargetBranch

This is the branch name itself and might need to have a prefix added (Like: "origin/") to match the branch that was provided to SeaLights when scanning the merged branch

 

GitLab

Please notice GitLab refers to this capability as Merge Request (MR) and not as Pull Request (See GitLab documentation for more details).

Then, switching to the “Commits” tab:

More details for GitLab may be found in the official documentation: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

Using the GitLab plugin for Jenkins

If you’re using the GitLab plugin for Jenkins you can use the following mapping to environment variables provided by the plugin

Sealights PR Parameter

GitLab plugin variables

Comment