Commit eac19b28 authored by Ben Boeckel's avatar Ben Boeckel

api: expose {should,force}_remove_source_branch

Workflows which use a bot to merge should remove branches if requested.
Expose the flag so that bots can request know this.
parent 3239c5f6
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.10.0 (unreleased) v 8.10.0 (unreleased)
- Expose {should,force}_remove_source_branch (Ben Boeckel)
- Fix commit builds API, return all builds for all pipelines for given commit. !4849 - Fix commit builds API, return all builds for all pipelines for given commit. !4849
- Replace Haml with Hamlit to make view rendering faster. !3666 - Replace Haml with Hamlit to make view rendering faster. !3666
- Refactor repository paths handling to allow multiple git mount points - Refactor repository paths handling to allow multiple git mount points
......
...@@ -68,7 +68,9 @@ Parameters: ...@@ -68,7 +68,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : false, "subscribed" : false,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
] ]
``` ```
...@@ -132,7 +134,9 @@ Parameters: ...@@ -132,7 +134,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -233,6 +237,8 @@ Parameters: ...@@ -233,6 +237,8 @@ Parameters:
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1, "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"changes": [ "changes": [
{ {
"old_path": "VERSION", "old_path": "VERSION",
...@@ -312,7 +318,9 @@ Parameters: ...@@ -312,7 +318,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 0 "user_notes_count": 0,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -383,7 +391,9 @@ Parameters: ...@@ -383,7 +391,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -481,7 +491,9 @@ Parameters: ...@@ -481,7 +491,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -547,7 +559,9 @@ Parameters: ...@@ -547,7 +559,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -866,7 +880,9 @@ Example response: ...@@ -866,7 +880,9 @@ Example response:
"merge_when_build_succeeds": false, "merge_when_build_succeeds": false,
"merge_status": "unchecked", "merge_status": "unchecked",
"subscribed": true, "subscribed": true,
"user_notes_count": 7 "user_notes_count": 7,
"should_remove_source_branch": true,
"force_remove_source_branch": false
}, },
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/merge_requests/7", "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/merge_requests/7",
"body": "Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non.", "body": "Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non.",
......
...@@ -208,6 +208,8 @@ module API ...@@ -208,6 +208,8 @@ module API
merge_request.subscribed?(options[:current_user]) merge_request.subscribed?(options[:current_user])
end end
expose :user_notes_count expose :user_notes_count
expose :should_remove_source_branch?, as: :should_remove_source_branch
expose :force_remove_source_branch?, as: :force_remove_source_branch
end end
class MergeRequestChanges < MergeRequest class MergeRequestChanges < MergeRequest
......
...@@ -138,6 +138,8 @@ describe API::API, api: true do ...@@ -138,6 +138,8 @@ describe API::API, api: true do
expect(json_response['work_in_progress']).to be_falsy expect(json_response['work_in_progress']).to be_falsy
expect(json_response['merge_when_build_succeeds']).to be_falsy expect(json_response['merge_when_build_succeeds']).to be_falsy
expect(json_response['merge_status']).to eq('can_be_merged') expect(json_response['merge_status']).to eq('can_be_merged')
expect(json_response['should_close_merge_request']).to be_falsy
expect(json_response['force_close_merge_request']).to be_falsy
end end
it "should return merge_request" do it "should return merge_request" do
...@@ -147,6 +149,8 @@ describe API::API, api: true do ...@@ -147,6 +149,8 @@ describe API::API, api: true do
expect(json_response['iid']).to eq(merge_request.iid) expect(json_response['iid']).to eq(merge_request.iid)
expect(json_response['work_in_progress']).to eq(false) expect(json_response['work_in_progress']).to eq(false)
expect(json_response['merge_status']).to eq('can_be_merged') expect(json_response['merge_status']).to eq('can_be_merged')
expect(json_response['should_close_merge_request']).to be_falsy
expect(json_response['force_close_merge_request']).to be_falsy
end end
it 'should return merge_request by iid' do it 'should return merge_request by iid' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment