Skip to content

Bitbucket

bitbucket wraps the Bitbucket Cloud REST API (v2.0). One instance = one Bitbucket account (account email + API token, optional default workspace).

Operations cover the common review flows: searching repos, reading commits and diffs, listing and creating pull requests, posting PR comments — including inline comments anchored to a specific file and line — and taking review actions (approve, request changes, merge). Anything wick doesn't type yet is one httprest call away.

Sourceinternal/connectors/bitbucket/
Keybitbucket
Tierbuiltin (every wick app)

Configs

FieldTypeRequiredNotes
BaseURLURLDefaults to https://api.bitbucket.org/2.0.
EmailsecretAccount email used for Basic Auth.
APITokensecretBitbucket Cloud API token.
DefaultWorkspacestringWorkspace slug used when an op omits one.
DefaultPagelenintPage size for list ops. Default 20.
MaxPagelenintUpper bound wick will request. Default 100.

Operations

OpDestructiveInputWhat it does
search_repositoriesnoworkspace, query, pagelenSearch repos in a workspace.
get_repositorynoworkspace, repo_slugFetch one repo.
list_commitsnoworkspace, repo_slug, revision, path, pagelenList commits, optionally scoped to a branch/tag/hash and path.
get_commitnoworkspace, repo_slug, commitFetch one commit by hash or ref.
get_commit_diffnoworkspace, repo_slug, commitUnified diff for a commit (returns text).
list_pull_requestsnoworkspace, repo_slug, state, query, pagelenList PRs.
get_pull_requestnoworkspace, repo_slug, pull_request_idFetch one PR.
list_pull_request_commitsnoworkspace, repo_slug, pull_request_idCommits in a PR.
create_branchyesworkspace, repo_slug, name, targetCreate a branch.
create_file_commityesworkspace, repo_slug, branch, path, content, messageCreate/update a file via a commit.
create_pull_requestyesworkspace, repo_slug, title, source, destination, descriptionOpen a PR.
create_pull_request_commentyessee belowComment on a PR — top-level or inline.
approve_pull_requestyesworkspace, repo_slug, pull_request_idApprove a PR as the authenticated user. Idempotent.
request_changes_pull_requestyesworkspace, repo_slug, pull_request_idFlag a PR as needing changes. Mutually exclusive with approve.
merge_pull_requestyessee belowMerge a PR into its destination branch. Irreversible.

Destructive ops are opt-in per row at /manager/connectors/bitbucket/{id}.

Inline PR comments

create_pull_request_comment posts a top-level comment by default. To anchor it to a specific line in the diff, add the inline fields:

FieldTypeNotes
inline_pathstringFile path the comment attaches to (e.g. src/main.go). Required for any inline comment.
inline_tointLine number in the new (post-change) side of the diff. Needs inline_path.
inline_fromintLine number in the old (pre-change) side — use for removed/old lines instead of inline_to. Needs inline_path.

Set inline_to or inline_from, not both; inline_to wins if both are given. Omit all three for an ordinary top-level comment.

yaml
- id: review_note
  type: connector
  module: bitbucket
  op: create_pull_request_comment
  arg_modes:
    body: expression
  args:
    workspace: my-team
    repo_slug: web
    pull_request_id: "42"
    body: "{{.Node.review.result}}"
    inline_path: src/handler.go
    inline_to: 88

Merging a pull request

merge_pull_request accepts optional fields in addition to the required workspace, repo_slug, and pull_request_id:

FieldTypeNotes
merge_strategystringOne of merge_commit (default), squash, or fast_forward. Omit to use the repository's default setting.
messagestringOptional merge commit message. Defaults to Bitbucket's auto-generated message.
close_source_branchboolClose the source branch after a successful merge. Default false.
yaml
- id: merge_pr
  type: connector
  module: bitbucket
  op: merge_pull_request
  args:
    workspace: my-team
    repo_slug: web
    pull_request_id: "42"
    merge_strategy: squash
    close_source_branch: true

See also

Built with ❤️ by a developer, for developers.