MicroticaMicrotica

Git (SDK)

Read connected Git accounts, repositories, and branches with the SDK's git namespace to wire up pipelines and components programmatically.

The git namespace reads your connected Git integrations — the accounts, repositories, and branches you reference when creating pipelines and components.

Methods

MethodReturns
git.listAccounts(projectId)Connected Git accounts.
git.getAccount(projectId, accountId)One account's record.
git.listRepositories(projectId, accountId)Repositories reachable through an account.
git.listBranches(projectId, accountId, repositoryUrl)Branches in a repository.

listBranches takes the repository URL, not its id — read it from the url field on a repository returned by listRepositories.

Example

TypeScript
const accounts = await microtica.git.listAccounts(projectId);
const account = accounts[0]; // { gitAccountId, accountName, type: "github" | "bitbucket" }

const repos = await microtica.git.listRepositories(projectId, account.gitAccountId);
const repo = repos[0]; // { id, fullName, url }

const branches = await microtica.git.listBranches(
  projectId,
  account.gitAccountId,
  repo.url,
);
console.log(branches); // ["main", "develop", …]

Next steps

On this page