Feat: Allow Creation of MRs for Forked Target (#303)

feat: Adds MR creation for project forks
This commit is contained in:
Harrison (Harry) Cramer
2024-06-10 15:04:31 -04:00
committed by GitHub
parent 816b87cf91
commit 53d5647380
7 changed files with 123 additions and 185 deletions

View File

@@ -11,11 +11,12 @@ import (
)
type CreateMrRequest struct {
Title string `json:"title"`
Description string `json:"description"`
TargetBranch string `json:"target_branch"`
DeleteBranch bool `json:"delete_branch"`
Squash bool `json:"squash"`
Title string `json:"title"`
Description string `json:"description"`
TargetBranch string `json:"target_branch"`
DeleteBranch bool `json:"delete_branch"`
Squash bool `json:"squash"`
TargetProjectID int `json:"forked_project_id,omitempty"`
}
/* createMr creates a merge request */
@@ -59,6 +60,10 @@ func (a *api) createMr(w http.ResponseWriter, r *http.Request) {
Squash: &createMrRequest.Squash,
}
if createMrRequest.TargetProjectID != 0 {
opts.TargetProjectID = gitlab.Ptr(createMrRequest.TargetProjectID)
}
_, res, err := a.client.CreateMergeRequest(a.projectInfo.ProjectId, &opts)
if err != nil {