Skip to content
Proud to collaborate with Microsoft for Startups

github.code.delete_file ​

Delete a file from a GitHub repository

Delete a file from a GitHub repository via a commit.

Inputs:

  • owner: Repository owner (required).
  • repo: Repository name (required).
  • path: File path relative to repo root (required).
  • commit_message: Commit message (required).
  • sha: Current blob SHA of the file to delete (required).
  • branch: Working branch to commit to. The default branch, and an omitted branch (which GitHub resolves to the default branch), are refused unless allow_default_branch_write is true.
  • dry_run: Plan without mutating GitHub (optional, default: false). The default-branch guard still applies, so a plan never reports a write that a real run would refuse.
  • 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_write: Founder/human-only override (optional, default: false). Never set it from a Staff or agent tool binding.

Outputs (terminal state_data):

  • status: planned | deleted | not_found
  • applied: bool
  • commit_sha: str
  • commit_url: str
  • file_url: str

Guard: refuses a default-branch commit with a non-retryable DEFAULT_BRANCH_WRITE_REFUSED error (no branch protection is available on the ltinteg org, and default-branch pushes can deploy to production).

Compensation: Use github.code.update_file with the prior content and sha from github.code.get_file to restore the file. 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
pathstringYes—File path relative to repo root
commit_messagestringYes—Commit message
shastringYes—Current blob SHA of the file to delete
branchstringNo—Working branch to commit to; the default branch is refused
dry_runbooleanNo—Plan without mutating GitHub
default_branchstringNo—Known repository default branch (hint; never trusted to allow a write)
allow_default_branch_writebooleanNo—Allow committing to 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——
commit_shastringNo——
commit_urlstringNo——
file_urlstringNo——
shastringNo——
branchstringNo——
default_branchstringNo——
allow_default_branch_writebooleanNo——
commit_messagestringNo——
ownerstringNo——
pathstringNo——
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.delete_file",
  "initial_data": {
    "owner": "value",
    "repo": "value",
    "path": "value",
    "commit_message": "value"
  }
}