Skip to content
Proud to collaborate with Microsoft for Startups

github.refs.delete_ref ​

Delete a branch or tag Git ref from a GitHub repository

Delete a branch or tag Git ref from a GitHub repository.

Inputs:

  • owner: Repository owner (required).
  • repo: Repository name (required).
  • ref: Full Git ref, e.g. refs/heads/feature/x or refs/tags/v1.0.0 (required).
  • expected_sha: Current ref SHA guard (optional).
  • dry_run: Plan without mutating GitHub (optional, default: false).
  • default_branch: Known default branch name (optional). Only a hint: a match refuses without a metadata read; a mismatch is verified against GitHub.
  • allow_default_branch_delete: Permit deleting the default branch (optional, default: false). Founder/human-only; never set it from a Staff or agent tool binding.

Outputs (terminal state_data):

  • status: planned | deleted | not_found
  • applied: bool
  • ref: Full deleted/planned ref
  • sha: SHA the ref pointed at before deletion

Compensation: This workflow is the cleanup counterpart for ref-creating workflows. Plugin required: context.get_plugin("github") must expose a GitHub App installation.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-github
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
ownerstringYes—Repository owner
repostringYes—Repository name
refstringYes—Full Git ref, e.g. refs/heads/feature/x or refs/tags/v1.0.0
expected_shastringNo—Expected current ref SHA
dry_runbooleanNo—Plan without mutating GitHub
default_branchstringNo—Known repository default branch (hint; never trusted to allow a delete)
allow_default_branch_deletebooleanNo—Allow deleting the default branch. Founder/human-only override, default false. Never set from Staff or agent tool bindings, and never map it from caller input in a composition.

Output Schema ​

FieldTypeRequiredDefaultDescription
statusstringNo——
appliedbooleanNo——
dry_runbooleanNo——
refstringNo——
ref_typestringNo——
ref_namestringNo——
shastringNo——
default_branchstringNo——
allow_default_branch_deletebooleanNo——
expected_shastringNo——
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.refs.delete_ref",
  "initial_data": {
    "owner": "value",
    "repo": "value",
    "ref": "value"
  }
}