Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

refactor: add skip_ci option while rebasing MR #1897

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions merge_requests.go
Original file line number Diff line number Diff line change
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
Loading