Ensure a Branch Exists
A 2-step recipe with GitLab. We can help you get access.
Recipe · 2 steps
Ensure a Branch Exists
with GitLab · Software Construction Management
Works with AI assistants
Create a branch only when it does not already exist.
- Look up the branch by name. A 200 means it already exists; a 404 means it must be created.
- Create the missing branch from the supplied ref.
What you'll need to have ready
- privateToken: GitLab Private-Token used to authenticate the API calls.
- projectId: The ID or URL-encoded path of the project.
- branch: The branch name to ensure exists.
- ref: The ref (branch name or commit sha) to create the branch from.
For your developer
Arazzo workflow gitlab:ensure-branch-exists, 2 operations: getApiV4ProjectsIdRepositoryBranchesBranch → postApiV4ProjectsIdRepositoryBranches. Specs on APIs.io.