drone/gitrpc/merge.go
Johannes Batzill c827fa5e66 [MISC] Webhook Creation Default To Secure, Fix PR/Compare Commit Listing, Fix Merge Commit Message (#203)
This change is fixing a few things on both UI and backend side:
- update webhook creation screen to default to enable ssl verification (secure by default should always be the move)
- fix pr/compare commit listing to show correct diffs the head branch is ahead of the base branch (NOTE: THIS ONLY SHOWS THE LATEST 20 COMMITS - NO PAGINATION ADDED)
- fix merge commit message to contain the correct head branch, source repo path and pr numbers (similar'ish to github)
2023-01-13 02:49:39 -08:00

43 lines
1.0 KiB
Go

// Copyright 2022 Harness Inc. All rights reserved.
// Use of this source code is governed by the Polyform Free Trial License
// that can be found in the LICENSE.md file for this repository.
package gitrpc
import (
"context"
"github.com/harness/gitness/gitrpc/rpc"
)
type MergeBranchParams struct {
WriteParams
BaseBranch string
HeadRepoUID string
HeadBranch string
Title string
Message string
Force bool
DeleteHeadBranch bool
}
func (c *Client) MergeBranch(ctx context.Context, params *MergeBranchParams) (string, error) {
if params == nil {
return "", ErrNoParamsProvided
}
resp, err := c.mergeService.MergeBranch(ctx, &rpc.MergeBranchRequest{
Base: mapToRPCWriteRequest(params.WriteParams),
BaseBranch: params.BaseBranch,
HeadBranch: params.HeadBranch,
Title: params.Title,
Message: params.Message,
Force: params.Force,
DeleteHeadBranch: params.DeleteHeadBranch,
})
if err != nil {
return "", err
}
return resp.CommitId, nil
}