Merge a pull request
merge_pull_requestMerge a pull request in Forgejo, Codeberg, or Gitea using a chosen merge style, an optional head SHA guard, and optional head branch deletion.
Instructions
Merge a pull request (owner/repo/index; requires write mode). style is merge (default), rebase, rebase-merge, squash or fast-forward-only, as the repository allows; title and message set the merge commit's; delete_branch removes the head branch afterwards. Pass head_sha (get_pull_request's, in full) to merge only if nothing was pushed since you looked. The forge refuses a pull request that is not mergeable — conflicts, failing required checks or missing approvals — and says why. Answers with the pull request as it now stands, in get_pull_request's shape.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | Repository name. | |
| index | Yes | Pull-request number. | |
| owner | Yes | Repository owner. | |
| style | No | `merge` (the default), `rebase`, `rebase-merge`, `squash` or `fast-forward-only`. The repository's settings may allow only some of them. | |
| title | No | Merge commit title. The forge composes one when absent. | |
| message | No | Merge commit message body. | |
| head_sha | No | Merge only if the pull request's head is still this commit (the full SHA, from `get_pull_request`'s `head_sha`). Guards against merging something pushed after review. | |
| delete_branch | No | Delete the head branch after merging. Defaults to the repository's own setting. |