Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (a *App) processApprovalsAndReviewers() (bool, string, []string, error) {
func (a *App) addReviewStatusComment(allRequiredOwners codeowners.ReviewerGroups, maxReviewsMet bool) error {
// Comment on the PR with the codeowner teams required for review

if a.config.Quiet || len(allRequiredOwners) == 0 {
if a.config.Quiet {
a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The log message is now misleading after the logic change. The function no longer skips if there are no unapproved owners. The message should be updated to reflect that it only skips when quiet mode is enabled.

Suggested change
a.printDebug("Skipping review status comment (disabled or no unapproved owners).\n")
a.printDebug("Skipping review status comment (disabled).\n")

return nil
}
Comment on lines +297 to 300
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The removal of the len(allRequiredOwners) == 0 check means this function now executes even when all required reviewers have approved. However, the subsequent logic for generating the comment does not handle this case correctly, potentially leading to misleading comments. The debug message is also misleading now, as the function no longer skips if there are no unapproved owners.

Expand Down Expand Up @@ -334,7 +334,7 @@ func (a *App) addReviewStatusComment(allRequiredOwners codeowners.ReviewerGroups
if err != nil {
return fmt.Errorf("UpdateComment Error: %v", err)
}
} else {
} else if len(allRequiredOwners) > 0 {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The condition len(allRequiredOwners) > 0 is now checked in an else if block. This means that if existingFound is false (i.e., no existing comment was found) and len(allRequiredOwners) is also 0 (i.e., all required owners have approved), no comment will be added. This contradicts the PR description, which states that the review comment should be updated even when all PRs are satisfied.

a.printDebug("Adding new review status comment: %q\n", comment)
err = a.client.AddComment(comment)
if err != nil {
Expand Down
Loading