Skip to content
Proud to collaborate with Microsoft for Startups

github.code.create_branch ​

Create a new branch in a GitHub repository

Create a new branch in a GitHub repository.

from_ref can be a commit SHA or a branch name. When a branch name is provided, it is resolved to its tip SHA automatically.

Inputs:

  • owner: Repository owner (required).
  • repo: Repository name (required).
  • branch_name: Name for the new branch (required).
  • from_ref: Commit SHA or existing branch name to branch from (required).

Outputs (terminal state_data):

  • branch_name: str — name of the new branch
  • sha: str — commit SHA the branch points to
  • ref: str — full ref, e.g. refs/heads/feature/my-feature

Compensation: Delete the branch with github.code.delete_branch. Plugin required: context.get_plugin("github") must expose .token.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-github
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
ownerstringYes—Repository owner
repostringYes—Repository name
branch_namestringYes—Name for the new branch
from_refstringYes—Commit SHA or existing branch name

Output Schema ​

FieldTypeRequiredDefaultDescription
branch_namestringNo——
refstringNo——
shastringNo——
from_refstringNo——
ownerstringNo——
repostringNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
failed_stepstringNo——
failed_layerstringNo——
errorstringNo——
error_typestringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "github.code.create_branch",
  "initial_data": {
    "owner": "value",
    "repo": "value",
    "branch_name": "value",
    "from_ref": "value"
  }
}