Skip to content

Commit

Permalink
chore: adding more detailed logs for policy approval
Browse files Browse the repository at this point in the history
Signed-off-by: Jaden Lee <[email protected]>
Signed-off-by: lee2sh <[email protected]>
  • Loading branch information
lee2sh committed Dec 17, 2024
1 parent 52f8e05 commit 6393af5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/events/project_command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6393af5

Please sign in to comment.