Merge a pull request
POST
/repos/{owner}/{repo}/pulls/{index}/merge
const url = 'https://gitea.com/api/v1/repos/example/example/pulls/1/merge';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"delete_branch_after_merge":true,"do":"merge","force_merge":true,"head_commit_id":"example","merge_commit_id":"example","merge_message_field":"example","merge_title_field":"example","merge_when_checks_succeed":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.com/api/v1/repos/example/example/pulls/1/merge \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "delete_branch_after_merge": true, "do": "merge", "force_merge": true, "head_commit_id": "example", "merge_commit_id": "example", "merge_message_field": "example", "merge_title_field": "example", "merge_when_checks_succeed": true }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”owner
required
string
Owner of the repo
repo
required
string
Name of the repo
index
required
integer format: int64
Index of the pull request to merge
Request Body
Section titled “Request Body”Media typeapplication/json
MergePullRequestOption
MergePullRequestForm form for merging Pull Request
object
delete_branch_after_merge
boolean
do
required
string
force_merge
boolean
head_commit_id
string
merge_commit_id
string
merge_message_field
string
merge_title_field
string
merge_when_checks_succeed
Merge once branch protection requirements like required status checks and approvals are met. Other checks are not awaited.
boolean
Responses
Section titled “Responses”APIEmpty is an empty response
APIEmpty is an empty response
default
Section titled “default”APIError is error format response
Media typeapplication/json
APIError
Is an api error with a message
object
message
Message contains the error description
string
url
URL contains the documentation URL for this error
string format: uri
Example generated
{ "message": "example", "url": "https://example.com"}