From 6393af5643dff67f4d985b788d355dc2ddf8f250 Mon Sep 17 00:00:00 2001 From: lee2sh Date: Tue, 17 Dec 2024 14:36:28 -0500 Subject: [PATCH] chore: adding more detailed logs for policy approval Signed-off-by: Jaden Lee Signed-off-by: lee2sh --- server/events/project_command_runner.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/events/project_command_runner.go b/server/events/project_command_runner.go index 26d4dc2cc2..8c5d810cca 100644 --- a/server/events/project_command_runner.go +++ b/server/events/project_command_runner.go @@ -405,6 +405,9 @@ func (p *DefaultProjectCommandRunner) doApprovePolicies(ctx command.ProjectConte } else { prjPolicyStatus[i].Approvals = 0 } + // User matches the author and prevent self approve is set to true + } else if isOwner && !ignorePolicy && ctx.User.Username == ctx.Pull.Author && policySet.PreventSelfApprove { + 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)) // User is not authorized to approve policy set. } else if !ignorePolicy { 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))