-
Notifications
You must be signed in to change notification settings - Fork 45
feat: add option to hide comments when no changes detected #492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
885ebc6
7c0dfb4
568422d
d1e10d6
5609172
7b6d3a8
e351cc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -301,8 +301,10 @@ func (ce *CheckEvent) Process(ctx context.Context) error { | |||||||||||||
|
|
||||||||||||||
| if len(ce.affectedItems.Applications) <= 0 && len(ce.affectedItems.ApplicationSets) <= 0 { | ||||||||||||||
| ce.logger.Info().Msg("No affected apps or appsets, skipping") | ||||||||||||||
| if _, err := ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf("## Kubechecks %s Report\nNo changes", ce.ctr.Config.Identifier)); err != nil { | ||||||||||||||
| return errors.Wrap(err, "failed to post changes") | ||||||||||||||
| if ce.ctr.Config.ShowNoChangesComment { | ||||||||||||||
| if _, err := ce.ctr.VcsClient.PostMessage(ctx, ce.pullRequest, fmt.Sprintf("## Kubechecks %s Report\nNo changes", ce.ctr.Config.Identifier)); err != nil { | ||||||||||||||
| return errors.Wrap(err, "failed to post no-changes report") | ||||||||||||||
| } | ||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add debug log that post has been skipped.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rvbsalgado thank you for the PR, other than the debug print, it looks good on me. we can deploy it on the next release (prob 3.0.0-rc2)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Greyeye added your suggestion 🙏 normally when is the next release scheduled?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rvbsalgado We got no schedule, but happy to tag new version when ready. I also had another look. kubechecks/pkg/events/check.go Line 503 in 15ba686
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you also add Caller() to the debug? |
||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| } | |
| } | |
| // Even when there are no affected apps/appsets, set an explicit skip status | |
| if err := ce.ctr.VcsClient.SetStatus(ctx, ce.pullRequest, pkg.StateSkip, "No affected apps or appsets"); err != nil { | |
| ce.logger.Error().Err(err).Msg("Failed to set skip status for no-op run") | |
| } |
Copilot
AI
Mar 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new ShowNoChangesComment behavior in Process is not covered by tests. Since pkg/events/check_test.go already exists for this file, please add a unit test that verifies VcsClient.PostMessage is called when ShowNoChangesComment=true and is not called when it is false (and that the method still returns nil).
Uh oh!
There was an error while loading. Please reload this page.