Skip to content

Commit 6393af5

Browse files
committed
chore: adding more detailed logs for policy approval
Signed-off-by: Jaden Lee <[email protected]> Signed-off-by: lee2sh <[email protected]>
1 parent 52f8e05 commit 6393af5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

server/events/project_command_runner.go

+3
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ func (p *DefaultProjectCommandRunner) doApprovePolicies(ctx command.ProjectConte
405405
} else {
406406
prjPolicyStatus[i].Approvals = 0
407407
}
408+
// User matches the author and prevent self approve is set to true
409+
} else if isOwner && !ignorePolicy && ctx.User.Username == ctx.Pull.Author && policySet.PreventSelfApprove {
410+
prjErr = multierror.Append(prjErr, fmt.Errorf("policy set: %s the author of pr %s matches the command commenter user %s - please contact another policy owners to approve failing policies", policySet.Name, ctx.Pull.Author, ctx.User.Username))
408411
// User is not authorized to approve policy set.
409412
} else if !ignorePolicy {
410413
prjErr = multierror.Append(prjErr, fmt.Errorf("policy set: %s user %s is not a policy owner - please contact policy owners to approve failing policies", policySet.Name, ctx.User.Username))

0 commit comments

Comments
 (0)