This article explains how to get the status of the Pull Request with Bitbucket Command Line Interface (CLI).
Instructions
Use getPullRequest action to get the status of the Pull Request. Pull requests are a feature that makes it easier for developers to collaborate using bitbucket.
The parameter used in the below action:
--project value refers to the project key.
--repository value refers to the repository name.
--pullRequest value refers to the name of the Pull Request.
Execute this action to add a job in the stage of a plan.
--action getPullRequest --project "TEST" --repository "repo" --pullRequest "example"
The output of CLI action:
Here, the Status is "NEEDS_WORK"
Data for pull request: example Project . . . . . . . . . . . : TEST Repository . . . . . . . . . : repo Id . . . . . . . . . . . . . : 18 Version . . . . . . . . . . . : 2 Name . . . . . . . . . . . . : example Description . . . . . . . . . : State . . . . . . . . . . . . : OPEN Created . . . . . . . . . . . : 13/4/20 3:22 PM Updated . . . . . . . . . . . : 13/4/20 4:07 PM From . . . . . . . . . . . . : Id . . . . . . . . . . . . : refs/heads/testam Name . . . . . . . . . . . : testam Latest commit . . . . . . . : 0aaceb5cbfe69e03d00539ce286e50a7423982c0 To . . . . . . . . . . . . . : Id . . . . . . . . . . . . : refs/heads/master Name . . . . . . . . . . . : master Latest commit . . . . . . . : 4e2b94a0d019e21abd21635de7d6d0c1e010a077 Author . . . . . . . . . . . : User . . . . . . . . . . . : User id . . . . . . . . . : automation Display name . . . . . . : Automation Role . . . . . . . . . . . : AUTHOR Reviewers . . . . . . . . . . : Reviewer . . . . . . . . . : User . . . . . . . . . . : User id . . . . . . . . : testam Display name . . . . . : testam Role . . . . . . . . . . : REVIEWER Status . . . . . . . . . : NEEDS_WORK Approved . . . . . . . . : No URL . . . . . . . . . . . . . : http://example.com/projects/TEST/repos/repo/pull-requests/18
It is recommended to test the commands in a non-production environment before running in the production.