This article explains how to get the status of a pull request using Bitbucket Command Line Interface (CLI) app.
Instructions
Use getPullRequest action to get the status of a pull request. Pull requests are a feature that make it easier for developers to collaborate using Bitbucket.
Execute this action to get the status of the pull request.
--action getPullRequest --project "TEST" --repository "repo" --pullRequest "example"
The output of CLI action is as below. 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
The parameters used in the above action are:
--project value refers to the project key.
--repository value refers to the repository name.
--pullRequest value refers to the name of the pull request.
It is recommended to test the command in a non-production environment before running in production, or, run the action with --simulate parameter to verify the behavior before deploying.