Skip to content

bb reviewer

Choose who is added to a pull request as a reviewer by default

Manage default reviewer conditions.

Note on CODEOWNERS: .bitbucket/CODEOWNERS is a git-tracked file rather than a REST resource, so it is managed through repository contents and not by this command. For server-level reviewer rules use default-reviewer conditions (bb reviewer condition) and reviewer groups (bb reviewer-group); bb pr create and bb pr review reviewer add ask Bitbucket which code owners a change has, so they match what the web interface shows.

4 commands.

bb reviewer condition
Create, list, update and delete default reviewer conditions (4 commands)

bb reviewer condition

Create, list, update and delete default reviewer conditions

create
Create a default reviewer condition
delete
Delete a default reviewer condition
list
List default reviewer conditions
update
Update a default reviewer condition

bb reviewer condition create

Create a default reviewer condition

bb reviewer condition create [json-config] [flags]

Create a default reviewer condition using JSON from argument, file (--config-file), or stdin (-)

# One approval from a named user on every pull request into main
bb reviewer condition create --repo PROJ/repo \
  '{"sourceMatcher":{"id":"ANY_REF","type":{"id":"ANY_REF"}},"targetMatcher":{"id":"refs/heads/main","type":{"id":"BRANCH"}},"reviewers":[{"id":101}],"requiredApprovals":1}'

# The same for a whole project, from a file
bb reviewer condition create --project PROJ --config-file condition.json
--config-file string
JSON file containing condition settings

Inherited from bb reviewer:

--project string
Project key
--repo string
Repository as PROJECT/slug

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  id?                integer                                                            Condition identifier, which update and
                                                                                        delete address.
  requiredApprovals  integer                                                            How many of the named reviewers must
                                                                                        approve before the pull request can
                                                                                        merge.
  sourceRefMatcher?  object                                                             Which source branches the condition
                                                                                        applies to.
    id?              string                                                             Matcher value: a branch name, a pattern,
                                                                                        or a model branch id depending on type.
    displayId?       string                                                             Human-readable form of the same thing.
    type?            ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                        MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                        decides how id is read.
  targetRefMatcher?  object                                                             Which target branches the condition
                                                                                        applies to.
    id?              string                                                             Matcher value: a branch name, a pattern,
                                                                                        or a model branch id depending on type.
    displayId?       string                                                             Human-readable form of the same thing.
    type?            ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                        MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                        decides how id is read.
  reviewers?         list of object                                                     Individual users added as default
                                                                                        reviewers.
    id?              integer                                                            Identifier, unique among users or among
                                                                                        groups.
    name?            string                                                             Username for a user, group name for a
                                                                                        group.
  reviewerGroups?    list of object                                                     Groups added as default reviewers.
    id?              integer                                                            Identifier, unique among users or among
                                                                                        groups.
    name?            string                                                             Username for a user, group name for a
                                                                                        group.
  scope?             PROJECT|REPOSITORY                                                 PROJECT when the condition is inherited
                                                                                        from the project, REPOSITORY when it is
                                                                                        set on the repository itself.

bb reviewer condition delete

Delete a default reviewer condition

bb reviewer condition delete <condition-id> [flags]

Delete a default reviewer condition of a project, or with --repo of a repository.

With --repo, a condition the repository inherits from its project is refused: deleted through the repository, it would be deleted from every repository in the project. --project deletes it there.

# By the id bb reviewer condition list prints
bb reviewer condition delete 9 --repo PROJ/repo
-y, --yes
Confirm without being asked; applies only when the target is named with --repo PROJECT/slug or --project

Inherited from bb reviewer:

--project string
Project key
--repo string
Repository as PROJECT/slug

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  status  string  Outcome of the command.
  id      string  Identifier of the condition that was deleted.

bb reviewer condition list

List default reviewer conditions

bb reviewer condition list

List the default reviewer conditions of a project, or with --repo of a repository: its own, and those it inherits from its project, which are marked as inherited.

# A repository's conditions, and those it inherits from its project
bb reviewer condition list --repo PROJ/repo

# A project's
bb reviewer condition list --project PROJ

Inherited from bb reviewer:

--project string
Project key
--repo string
Repository as PROJECT/slug

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data
  conditions           list of object or null                                             Default-reviewer conditions in scope.
    id?                integer                                                            Condition identifier, which update and
                                                                                          delete address.
    requiredApprovals  integer                                                            How many of the named reviewers must
                                                                                          approve before the pull request can
                                                                                          merge.
    sourceRefMatcher?  object                                                             Which source branches the condition
                                                                                          applies to.
      id?              string                                                             Matcher value: a branch name, a pattern,
                                                                                          or a model branch id depending on type.
      displayId?       string                                                             Human-readable form of the same thing.
      type?            ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                          MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                          decides how id is read.
    targetRefMatcher?  object                                                             Which target branches the condition
                                                                                          applies to.
      id?              string                                                             Matcher value: a branch name, a pattern,
                                                                                          or a model branch id depending on type.
      displayId?       string                                                             Human-readable form of the same thing.
      type?            ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                          MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                          decides how id is read.
    reviewers?         list of object                                                     Individual users added as default
                                                                                          reviewers.
      id?              integer                                                            Identifier, unique among users or among
                                                                                          groups.
      name?            string                                                             Username for a user, group name for a
                                                                                          group.
    reviewerGroups?    list of object                                                     Groups added as default reviewers.
      id?              integer                                                            Identifier, unique among users or among
                                                                                          groups.
      name?            string                                                             Username for a user, group name for a
                                                                                          group.
    scope?             PROJECT|REPOSITORY                                                 PROJECT when the condition is inherited
                                                                                          from the project, REPOSITORY when it is
                                                                                          set on the repository itself.

bb reviewer condition update

Update a default reviewer condition

bb reviewer condition update <condition-id> [json-config] [flags]

Update a default reviewer condition using JSON from argument, file (--config-file), or stdin (-)

With --repo, a condition the repository inherits from its project is refused; --project changes it there, for every repository in the project.

# Replace a condition with the one in a file
bb reviewer condition update 9 --repo PROJ/repo --config-file condition.json
--config-file string
JSON file containing condition settings

Inherited from bb reviewer:

--project string
Project key
--repo string
Repository as PROJECT/slug

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  id?                integer                                                            Condition identifier, which update and
                                                                                        delete address.
  requiredApprovals  integer                                                            How many of the named reviewers must
                                                                                        approve before the pull request can
                                                                                        merge.
  sourceRefMatcher?  object                                                             Which source branches the condition
                                                                                        applies to.
    id?              string                                                             Matcher value: a branch name, a pattern,
                                                                                        or a model branch id depending on type.
    displayId?       string                                                             Human-readable form of the same thing.
    type?            ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                        MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                        decides how id is read.
  targetRefMatcher?  object                                                             Which target branches the condition
                                                                                        applies to.
    id?              string                                                             Matcher value: a branch name, a pattern,
                                                                                        or a model branch id depending on type.
    displayId?       string                                                             Human-readable form of the same thing.
    type?            ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                        MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                        decides how id is read.
  reviewers?         list of object                                                     Individual users added as default
                                                                                        reviewers.
    id?              integer                                                            Identifier, unique among users or among
                                                                                        groups.
    name?            string                                                             Username for a user, group name for a
                                                                                        group.
  reviewerGroups?    list of object                                                     Groups added as default reviewers.
    id?              integer                                                            Identifier, unique among users or among
                                                                                        groups.
    name?            string                                                             Username for a user, group name for a
                                                                                        group.
  scope?             PROJECT|REPOSITORY                                                 PROJECT when the condition is inherited
                                                                                        from the project, REPOSITORY when it is
                                                                                        set on the repository itself.