Integrations / Bitbucket
Bitbucket
Git code hosting from Atlassian: repositories, pull requests and commits on Bitbucket Cloud.
8 actions
OAuth 2
5 read3 write
Calls api.bitbucket.org
Connect
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "bitbucket" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();Permissions requested
| Scope | Why it is requested |
|---|---|
account | Identify the connected Bitbucket account |
repository | Read your repositories and commits |
pullrequest | Read pull requests and comment on them |
pullrequest:write | Create and approve pull requests |
Actions
Approve pull requestwritebitbucket.approve_pull_requestApprove a pull request as the connected user. Does not merge it.
Needs scope: pullrequest:write
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
pull_request_id | integer | Required | Pull request id |
await setu.execute({
userId: "user_1",
action: "bitbucket.approve_pull_request",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>",
"pull_request_id": 1
},
});Create pull requestwritebitbucket.create_pull_requestOpen a pull request from a source branch into a destination branch (default: the repository's main branch).
Needs scope: pullrequest:write
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
title | string | Required | Pull request title |
source_branch | string | Required | Branch with the changes |
destination_branch | string | Optional | Branch to merge into; defaults to the main branch |
description | string | Optional | Pull request description |
await setu.execute({
userId: "user_1",
action: "bitbucket.create_pull_request",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>",
"title": "<title>",
"source_branch": "<source_branch>"
},
});Comment on pull requestwritebitbucket.create_pull_request_commentAdd a general comment to a pull request.
Needs scope: pullrequest
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
pull_request_id | integer | Required | Pull request id |
text | string | Required | Comment text (Markdown) |
await setu.execute({
userId: "user_1",
action: "bitbucket.create_pull_request_comment",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>",
"pull_request_id": 1,
"text": "<text>"
},
});Get pull requestreadbitbucket.get_pull_requestGet one pull request by id: title, state, source and destination branches and web URL.
Needs scope: pullrequest
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
pull_request_id | integer | Required | Pull request id |
await setu.execute({
userId: "user_1",
action: "bitbucket.get_pull_request",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>",
"pull_request_id": 1
},
});Get repositoryreadbitbucket.get_repositoryGet one repository: full name, privacy, main branch and web URL.
Needs scope: repository
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
await setu.execute({
userId: "user_1",
action: "bitbucket.get_repository",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>"
},
});List commitsreadbitbucket.list_commitsList recent commits in a repository, newest first. Returns hashes and messages.
Needs scope: repository
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
pagelen | integer | Optional | Results per page, up to 100 |
await setu.execute({
userId: "user_1",
action: "bitbucket.list_commits",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>"
},
});List pull requestsreadbitbucket.list_pull_requestsList pull requests in a repository, by default open ones. Returns ids, titles and states.
Needs scope: pullrequest
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
repo_slug | string | Required | Repository slug |
state | string | Optional | Filter by state |
pagelen | integer | Optional | Results per page, up to 50 |
await setu.execute({
userId: "user_1",
action: "bitbucket.list_pull_requests",
input: {
"workspace": "<workspace>",
"repo_slug": "<repo_slug>"
},
});List repositoriesreadbitbucket.list_repositoriesList repositories in a Bitbucket workspace the user can see. Can filter by role or a Bitbucket query string.
Needs scope: repository
| Input | Type | Description | |
|---|---|---|---|
workspace | string | Required | Workspace id or slug |
role | string | Optional | Only repos where the user has this role |
q | string | Optional | Bitbucket query filter, e.g. name ~ "api" |
sort | string | Optional | Field to sort by, e.g. -updated_on |
pagelen | integer | Optional | Results per page, up to 100 |
await setu.execute({
userId: "user_1",
action: "bitbucket.list_repositories",
input: {
"workspace": "<workspace>"
},
});