Bitbucket Cloud¶
Setup¶
- Create a repository (or workspace) access token with the scopes
pullrequest:writeandrepository:read. Addrepository:adminonly if you run commands (see below). - Add repository variables, both marked as secured:
REVIEWLOOP_BITBUCKET_TOKEN: the access token.- Your agent credential (see the agent docs for the variable name).
- Copy
examples/bitbucket-pipelines.ymltobitbucket-pipelines.ymlin the repository root. - Enable Pipelines for the repository.
Every pull request now runs the pull-requests pipeline and posts a review. A pull request
that already has the bot's summary comment is skipped.
The example pins an exact image version; each reviewloop release bumps it in the example. Review a new version before you change yours.
What the job checks out¶
Bitbucket Pipelines checks out the pull request's source branch (the PR head), not the target branch. reviewloop
still reads .reviewloop.yml and repository rule files from the target branch through the API, but anything the
scanners read from the working tree is PR-controlled here: a .gitleaks.toml or opengrep ignore file committed in
the pull request can silence those scanners for that pull request. The agent review is not affected. Use
fail_on and branch protection with this in mind, and review changes to scanner config files.
Bot account UUID¶
The adapter must know which account is the bot to find its own summary and threads. It asks
GET /2.0/user, which repository and workspace access tokens may be denied (it can need the
account scope). When that happens the run fails with an error naming
REVIEWLOOP_BITBUCKET_BOT_UUID. Set it as a repository variable to the token's bot account UUID:
- Post one comment on any pull request with the token (for example with
curland the token as a Bearer header). - Read that comment from the API (
GET /2.0/repositories/{workspace}/{repo}/pullrequests/{id}/comments) and copyuser.uuid, braces included, for example{...}.
Skip this step if /2.0/user works for your token.
Run a command¶
Bitbucket pipelines do not start on comments, so commands run from the UI:
- Open Pipelines and choose Run pipeline.
- Select the branch, then the custom pipeline
reviewloop-command. - Set
PR_IDto the pull request number andCOMMANDtoreview,recheckorhelp. - Run it. Only users with write or admin access to the repository can trigger commands.
Checking the triggering user's permission reads the repository's user permissions, which Bitbucket
restricts to the repository:admin scope. Without it the command fails with an error naming the
missing scope; the user is never silently rejected. Review runs on pull requests do not need it.
Only explicit user permissions on the repository are checked. A user who has write access only through a group or the workspace must be granted an explicit user permission before they can run commands.
Limits¶
- Bitbucket Cloud has no suggestion blocks; findings are posted as plain comments.
- Inline comments anchor on a single line; multi-line ranges are not supported.