gluecron_apply_patch
Commit a patch to a branch without sending whole files — the way to change a few lines of a large file. patch is a unified diff as git diff prints it (one commit, message required) OR git format-patch mbox output (each patch becomes its own commit with the patch's own message and author, like git am; message is ignored). Applied server-side with git apply --cached against the branch head (created from base_branch if missing); expected_head_sha makes it compare-and-swap (all zeros = branch must not exist yet). Meets the same branch protection, rulesets and secret scan as a git push, and fires CI/webhooks like one. Patch limit 2 MiB. Requires 'repo' scope. Returns {branch, commit_sha, parent_sha, files_changed, files, commits, created}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | ||
| owner | Yes | ||
| patch | Yes | Unified diff (`git diff`, a/ b/ prefixes) or `git format-patch` mbox text. Max 2 MiB. | |
| branch | Yes | Target branch (short name). Created if it does not exist. | |
| message | No | Commit message. Required for a unified diff; ignored for mbox input (each patch carries its own). | |
| base_branch | No | Branch to fork from when `branch` does not exist yet (default: the repo's default branch). | |
| expected_head_sha | No | Optional compare-and-swap: the 40-hex sha you expect `branch` to point at. Refused if it moved. All zeros = the branch must not exist. |