mirror of
https://github.com/harness/drone.git
synced 2025-05-20 19:09:59 +08:00
merge API: return if the branch is deleted (#701)
This commit is contained in:
parent
fcc8c0be73
commit
8d82daf876
@ -247,6 +247,7 @@ func (c *Controller) Merge(
|
||||
SourceSHA: mergeOutput.HeadSHA,
|
||||
})
|
||||
|
||||
var branchDeleted bool
|
||||
if ruleOut.DeleteSourceBranch {
|
||||
errDelete := c.gitRPCClient.DeleteBranch(ctx, &gitrpc.DeleteBranchParams{
|
||||
WriteParams: sourceWriteParams,
|
||||
@ -255,11 +256,14 @@ func (c *Controller) Merge(
|
||||
if errDelete != nil {
|
||||
// non-critical error
|
||||
log.Ctx(ctx).Err(errDelete).Msgf("failed to delete source branch after merging")
|
||||
} else {
|
||||
branchDeleted = true
|
||||
}
|
||||
}
|
||||
|
||||
return types.MergeResponse{
|
||||
SHA: sha,
|
||||
BranchDeleted: branchDeleted,
|
||||
RuleViolations: violations,
|
||||
}, nil
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ type PullReqFileView struct {
|
||||
|
||||
type MergeResponse struct {
|
||||
SHA string `json:"sha,omitempty"`
|
||||
BranchDeleted bool `json:"branch_deleted"`
|
||||
ConflictFiles []string `json:"conflict_files,omitempty"`
|
||||
RuleViolations []RuleViolations `json:"rule_violations,omitempty"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user