diff options
author | Tony Rom <thetonyrom@gmail.com> | 2017-11-16 21:10:15 +0300 |
---|---|---|
committer | Tony Rom <thetonyrom@gmail.com> | 2017-12-15 19:53:57 +0300 |
commit | fd88b0ca56b3a4230902f76a7b049228e53e6bb0 (patch) | |
tree | fdb0ac8c494817e946bc3b342c54e3b17e4e2e0d /lib/api | |
parent | 627a96875ee68e37b45192af3121f09032ea4bbf (diff) |
Add `pipelines` endpoint to merge requests API
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/merge_requests.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index d34886fca2e..77c563ec0b4 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -24,6 +24,12 @@ module API .preload(:notes, :author, :assignee, :milestone, :latest_merge_request_diff, :labels, :timelogs) end + def merge_request_pipelines_with_access(access_level = :read_pipeline) + authorize! access_level, user_project + mr = find_merge_request_with_access(params[:merge_request_iid]) + mr.all_pipelines + end + params :merge_requests_params do optional :state, type: String, values: %w[opened closed merged all], default: 'all', desc: 'Return opened, closed, merged, or all merge requests' @@ -203,6 +209,15 @@ module API present merge_request, with: Entities::MergeRequestChanges, current_user: current_user end + desc 'Get the merge request pipelines' do + success Entities::PipelineBasic + end + get ':id/merge_requests/:merge_request_iid/pipelines' do + pipelines = merge_request_pipelines_with_access + + present paginate(pipelines), with: Entities::PipelineBasic + end + desc 'Update a merge request' do success Entities::MergeRequest end |