Skip to content

Commit

Permalink
Merge pull request #1897 from GaikwadPratik/rebase_mr_skip_ci
Browse files Browse the repository at this point in the history
refactor: add `skip_ci` option while rebasing MR
  • Loading branch information
svanharmelen committed Mar 12, 2024
2 parents c2cfe45 + 928d176 commit 0968e9e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions merge_requests.go
Expand Up @@ -860,20 +860,29 @@ func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{},
return m, resp, nil
}

// RebaseMergeRequestOptions represents the available RebaseMergeRequest()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/merge_requests.html#rebase-a-merge-request
type RebaseMergeRequestOptions struct {
SkipCI *bool `url:"skip_ci,omitempty" json:"skip_ci,omitempty"`
}

// RebaseMergeRequest automatically rebases the source_branch of the merge
// request against its target_branch. If you don’t have permissions to push
// to the merge request’s source branch, you’ll get a 403 Forbidden response.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/merge_requests.html#rebase-a-merge-request
func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*Response, error) {
func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest int, opt *RebaseMergeRequestOptions, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/rebase", PathEscape(project), mergeRequest)

req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 0968e9e

Please sign in to comment.