Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains how to get the status of the Pull Request with a pull request using the Bitbucket Command Line Interface (CLI).

Instructions

Use getPullRequest action to get the status of the Pull Request app. Pull requests are a feature that makes make it easier for developers to collaborate using bitbucketBitbucket.
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.

...

Instructions

Use getPullRequest action to get the status of a pull request. 

Execute the following command to get the status of the

...

pull request:

Code Block
themeMidnight
--action getPullRequest --project "TEST" --repository "repo" --pullRequest "example"

Note that sample parameter values are specified in the given command. You must specify relevant values in this command to get the status of the required pull request in your instance.

The output of CLI action

...

with the sample values displays a 'NEEDS_WORK

...

' status as shown:

Code Block
themeMidnight
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 with the 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.
Info

It is recommended to test the commands command in a non-production environment before running in the productionproductionor, run the action with --simulate parameter to verify the behaviour before deploying.