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 ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-github |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
owner | string | Yes | — | Repository owner |
repo | string | Yes | — | Repository name |
path | string | Yes | — | File path relative to repo root |
commit_message | string | Yes | — | Commit message |
sha | string | Yes | — | Current blob SHA of the file to delete |
branch | string | No | — | Working branch to commit to; the default branch is refused |
dry_run | boolean | No | — | Plan without mutating GitHub |
default_branch | string | No | — | Known repository default branch (hint; never trusted to allow a write) |
allow_default_branch_write | boolean | No | — | 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 ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
status | string | No | — | — |
applied | boolean | No | — | — |
dry_run | boolean | No | — | — |
commit_sha | string | No | — | — |
commit_url | string | No | — | — |
file_url | string | No | — | — |
sha | string | No | — | — |
branch | string | No | — | — |
default_branch | string | No | — | — |
allow_default_branch_write | boolean | No | — | — |
commit_message | string | No | — | — |
owner | string | No | — | — |
path | string | No | — | — |
repo | string | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
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"
}
}