Docs for merge api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
0c73e66643
commit
5880d7df62
2 changed files with 49 additions and 0 deletions
|
@ -189,6 +189,54 @@ Parameters:
|
|||
```
|
||||
|
||||
|
||||
## Accept MR
|
||||
|
||||
Merge changes submitted with MR usign this API.
|
||||
If merge success you get 200 OK.
|
||||
If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged'
|
||||
If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed'
|
||||
If you dont have permissions to accept this merge request - you get 401
|
||||
|
||||
```
|
||||
PUT /projects/:id/merge_request/:merge_request_id/merge
|
||||
```
|
||||
|
||||
Parameters:
|
||||
|
||||
+ `id` (required) - The ID of a project
|
||||
+ `merge_request_id` (required) - ID of MR
|
||||
+ `merge_commit_message` (optional) - Custom merge commit message
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"target_branch": "master",
|
||||
"source_branch": "test1",
|
||||
"project_id": 3,
|
||||
"title": "test1",
|
||||
"state": "merged",
|
||||
"upvotes": 0,
|
||||
"downvotes": 0,
|
||||
"author": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"email": "admin@local.host",
|
||||
"name": "Administrator",
|
||||
"state": "active",
|
||||
"created_at": "2012-04-29T08:46:00Z"
|
||||
},
|
||||
"assignee": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"email": "admin@local.host",
|
||||
"name": "Administrator",
|
||||
"state": "active",
|
||||
"created_at": "2012-04-29T08:46:00Z"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Post comment to MR
|
||||
|
||||
Adds a comment to a merge request.
|
||||
|
|
|
@ -137,6 +137,7 @@ module API
|
|||
if merge_request.open?
|
||||
if merge_request.can_be_merged?
|
||||
merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message)
|
||||
present merge_request, with: Entities::MergeRequest
|
||||
else
|
||||
render_api_error!('Branch cannot be merged', 405)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue