List repositories
id, which never changes. Names and hosts can change, so list the repositories again rather than caching them for long. Customers change the selection without notice; this list is the authority on what you may touch.
Mint an access token
201:
Errors
Error bodies are RFC 9457 problem documents, with a machine-readable
code member.
Create a repository
A plugin registered withrepositories:create can create repositories in the installation’s project. The customer sees “Create repositories in this project” on the install page. The permission only creates: it doesn’t read or write contents, delete repositories or change settings. To push to a repository you created, register contents:write too.
First mint a token with no repository_id:
"permissions": {"repositories": "create", "installations": "read"}. The token reaches no repository. The installation-wide token, minted with every permission you registered, also creates.
Then create the repository on the same Core:
objectFormat is optional: sha1, the default, or sha256. Leave out projectId, and Core uses the installation’s project. Any other project answers 404. Plugins can’t set clusterHost or mirrorClusterSlugs.
A successful create answers 201 with the repository:
repositoryId. It is the id the repository list, access tokens and webhooks use. Core answers only once the installation covers the new repository, so you can mint a token for it right away. If the customer selected a list of repositories, the new one joins it. Every installation that covers it receives installation.repositories_added.
Wait for provisioning
Whenstate is active, the repository is ready. When it is provisioning, Git and region API calls fail until it’s ready. List the installation’s repositories until the new one has a placement whose role is processing_primary, then send calls to that placement’s api_base_url.
Create errors
Core answers a refused create with an RFC 9457 problem document. Branch on itstype, not on the status alone: 409 and 429 carry other conditions too.
A create is not idempotent. If the connection drops before you read the response, list the installation’s repositories before you create again: a
409 can mean your own earlier create succeeded.