Feat: Add and Remove Labels from an MR (#159)

This MR adds the ability to add or remove labels to a merge request. These labels are visible in the summary panel and are colored the same way as they would be in the Gitlab UI.

This is a MINOR release.
This commit is contained in:
Harrison (Harry) Cramer
2024-01-13 10:37:05 -05:00
committed by GitHub
parent 67f09e559a
commit 50e06ceff6
12 changed files with 306 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ type fakeClient struct {
retryPipelineBuild func(pid interface{}, pipeline int, options ...gitlab.RequestOptionFunc) (*gitlab.Pipeline, *gitlab.Response, error)
listPipelineJobs func(pid interface{}, pipelineID int, opts *gitlab.ListJobsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Job, *gitlab.Response, error)
getTraceFile func(pid interface{}, jobID int, options ...gitlab.RequestOptionFunc) (*bytes.Reader, *gitlab.Response, error)
listLabels func(pid interface{}, opt *gitlab.ListLabelsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Label, *gitlab.Response, error)
}
type Author struct {
@@ -120,6 +121,10 @@ func (f fakeClient) GetTraceFile(pid interface{}, jobID int, options ...gitlab.R
return f.getTraceFile(pid, jobID, options...)
}
func (f fakeClient) ListLabels(pid interface{}, opt *gitlab.ListLabelsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Label, *gitlab.Response, error) {
return f.listLabels(pid, opt, options...)
}
/* This middleware function needs to return an ID for the rest of the handlers */
func (f fakeClient) ListProjectMergeRequests(pid interface{}, opt *gitlab.ListProjectMergeRequestsOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.MergeRequest, *gitlab.Response, error) {
return []*gitlab.MergeRequest{{ID: 1}}, &gitlab.Response{}, nil