Created
February 6, 2023 17:40
-
-
Save artem-hatchenko/e4665cff70be69af1189f8149fa46a1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def payload_json = "${env.json_payload}".substring(1, "${env.json_payload}".length() - 1); // removing extra curly braces from json payload | |
def parsed_json = new JsonSlurper().parseText("{$payload_json}"); | |
env.REPO_FULL_NAME = parsed_json.pullrequest.source.repository.full_name // Get full repo name (consists of: <workspace>/<repo_slug>) | |
env.COMMIT_HASH = parsed_json.pullrequest.source.commit.hash // Get pull request commit hash | |
env.PULL_REQUEST_ID = parsed_json.pullrequest.id // Get pull request id | |
env.PULL_REQUEST_TITLE = parsed_json.pullrequest.title // Get pull request title | |
env.PULL_REQUEST_URL = parsed_json.pullrequest.links.html.href // Get pull request URL | |
env.PULL_REQUEST_COMMENT_COUNT = parsed_json.pullrequest.comment_count // Get number of comments in pull request | |
env.BRANCH = parsed_json.pullrequest.source.branch.name // Get pull request branch name | |
env.AUTHOR = parsed_json.pullrequest.author.nickname // Get username of author | |
env.AUTHOR_ID = parsed_json.pullrequest.author.account_id // Get account ID of author | |
env.REVIEWERS_ID = parsed_json.pullrequest.reviewers.account_id // Get account ID of reviewers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment