feat(slack): slack-notify-on always|failure switch - #133
Merged
Merged
Conversation
Signed-off-by: Julio Jimenez <julio@julioj.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The behavior is consistent across configuration, execution, metadata, documentation, and focused tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds configurable Slack notification filtering while preserving failure alerts and existing defaults.
Changes:
- Adds and validates the
always/failurenotification mode. - Suppresses successful notifications in failure-only mode with test coverage.
- Documents the input and updates release metadata.
| File | Description |
|---|---|
README.md |
Documents notification modes and usage. |
internal/config/config.go |
Loads, normalizes, and validates the mode. |
internal/config/config_test.go |
Tests configuration and sensitivity behavior. |
cmd/clickbom/main.go |
Applies notification filtering. |
cmd/clickbom/main_test.go |
Tests filtering, posting, and logging. |
action.yml |
Exposes the new action input. |
CLAUDE.md |
Updates execution-flow documentation. |
Dockerfile |
Updates version labels to 2.2.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
slack-notify-oninput promised in the follow-ups of #132. Withfailure, a successful run posts nothing and logs one line,Slack notification skipped; failures post as before. The default isalways, so nothing changes for consumers that already setslack-webhook-url.Configuration failures bypass the switch on purpose. A job that cannot start is a failure, and an invalid
SLACK_NOTIFY_ONvalue is itself one, sonotifyConfigFailurestill posts when the webhook is valid.New input
slack-notify-onalways(default) posts every run;failureposts failed runs only. Case-insensitive, trimmed, ignored without a webhook.Any other value is rejected at start-up with
invalid SLACK_NOTIFY_ON: "..." (must be always or failure). The value is not sensitive, so the error may quote it.Changes
internal/config:SlackNotifyAlways/SlackNotifyOnFailureconstants,SlackNotifyOnfield, closed-set check inSanitize. An empty field meansalways, so aConfigbuilt withoutLoadConfigstill posts.cmd/clickbom:reportOutcomesits in front ofnotifyOutcomeand applies the switch viashouldNotify; the skip is logged at Info only when a webhook is configured.action.yml: the input andSLACK_NOTIFY_ONenv entry.README.md: table row, explanatory bullet, usage snippet; the version note now saysslack-notify-onfirst ships inv2.2.0.CLAUDE.md: execution-flow notes for the switch and the deliberate bypass on configuration failures.Dockerfile: version labels set to 2.2.0 for the upcoming release.Security properties
sensitiveEnvVarsandSecrets.TestConfigSecretsnow asserts thatfailureis never a redaction needle: it would blank the word "failure" in every posted error.Testing
go test -race ./...,golangci-lint run, gofmt and gocyclo pass.TestLoadConfig_SlackNotifyOn: default, both values with case and whitespace variants, rejected values naming the variable and the value, and the empty-field path throughSanitize.TestShouldNotifyandTestReportOutcome_HonoursNotifyOn: the four mode × outcome combinations against a local webhook server, the Info skip log, and silence when no webhook is configured.Follow-ups
v2.2.0and bump theClickHouse/sbomworkflows.