Skip to content

Conversation

@zbedforrest
Copy link
Collaborator

@zbedforrest zbedforrest commented Mar 25, 2025

Related PR(s)

Related Issue(s)

#5

Summary / Background

This PR adds a quiet mode to codeowners plus, which prevents the addition of comments to PRs and will not request reviews from unapproved owners. This feature should be especially useful for running codeowners on PR's that are still in draft status.

The readme is updated with info on what it does, and how to run in quiet mode.

@github-actions github-actions bot requested a review from BakerNet March 25, 2025 21:11
@zbedforrest zbedforrest marked this pull request as draft March 25, 2025 21:17
main.go Outdated
if !found {
err = a.client.AddComment(comment)
if !QUIET_MODE_TEST {
if len(unapprovedOwners) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Recommend && here to avoid additional layer of nesting

@BakerNet
Copy link
Collaborator

Codeowners approval required for this PR:

@zbedforrest zbedforrest marked this pull request as ready for review March 26, 2025 19:38
Copy link
Collaborator

@BakerNet BakerNet left a comment

Choose a reason for hiding this comment

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

Implementation looking good!

README.md Outdated

### Quiet Mode

You can run Codeowners Plus in a "quiet" mode using the `quiet` input in the GitHub Action or the `-quiet=true` flag in the CLI.
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can leave off the CLI flag detail - we only really talk about the use case in terms of the GHA. But add the flag to the CONTRIBUTING.md call

README.md Outdated
- @user2
```

### Quiet Mode
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't exactly in the right section - since this isn't a codeowners.toml config. But we don't have the right section atm. I think it would be good to have a "GHA Inputs" section where we talk about verbose and quiet

The README may be getting big enough that we should start thinking about collapsible sections or WIKI... but let's not worry about that in this PR

README.md Outdated

You can run Codeowners Plus in a "quiet" mode using the `quiet` input in the GitHub Action or the `-quiet=true` flag in the CLI.

**When Quiet Mode is Enabled:**
Copy link
Collaborator

@BakerNet BakerNet Mar 26, 2025

Choose a reason for hiding this comment

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

Prefer subheaders over bold with :

main_test.go Outdated
}
}

func TestAddReviewStatusComment_AddsComment(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you combine these into TestAddReviewStatusComment, TestAddOptionalComment, and TestRequestReviews with table-based tests rather than having separate tests for the different cases. See examples in codebase (grep tt :=) and styleguide/tests.md for example.

BTW, AI is pretty good at conversions like this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You got it. Yeah this is better

the AI actually struggled at first - kind of par for the course for me, I had to do the first one by hand, fed it as example, and then it got the other 2 tables

@BakerNet BakerNet linked an issue Mar 26, 2025 that may be closed by this pull request
@zbedforrest zbedforrest requested a review from BakerNet March 26, 2025 23:42
BakerNet
BakerNet previously approved these changes Mar 26, 2025
Copy link
Collaborator

@BakerNet BakerNet left a comment

Choose a reason for hiding this comment

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

Just one tiny change

Co-authored-by: Hans Baker <[email protected]>
@github-actions github-actions bot dismissed BakerNet’s stale review March 27, 2025 00:00

Changes in owned files since last approval

@zbedforrest zbedforrest requested a review from BakerNet March 27, 2025 00:04
@zbedforrest zbedforrest merged commit ac17468 into main Mar 27, 2025
10 checks passed
@zbedforrest zbedforrest deleted the feature/quiet-mode branch March 27, 2025 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow running Codeowners Plus on Draft in quiet mode (no Issue comments)

3 participants