fix: [CODE-2583]: fix dry-running merge without merge method (#2852)

* fix: [CODE-2583]: fix dry-running merge without merge method
pull/3576/head
Johannes Batzill 2024-10-22 23:06:12 +00:00 committed by Harness
parent 32e817888a
commit 7b5490ac10
1 changed files with 7 additions and 1 deletions

View File

@ -102,9 +102,15 @@ func (c *Controller) Merge(
pullreqNum int64,
in *MergeInput,
) (*types.MergeResponse, *types.MergeViolations, error) {
// keep track of original method in case it's empty, as it is optional for dry-run.
originalMergeMethod := in.Method
if err := in.sanitize(); err != nil {
return nil, nil, err
}
if originalMergeMethod != "" {
// use sanitized version if a non-empty merge method was provided.
originalMergeMethod = in.Method
}
requiredPermission := enum.PermissionRepoPush
if in.DryRun {
@ -212,7 +218,7 @@ func (c *Controller) Merge(
SourceRepo: sourceRepo,
PullReq: pr,
Reviewers: reviewers,
Method: in.Method,
Method: originalMergeMethod,
CheckResults: checkResults,
CodeOwners: codeOwnerWithApproval,
})