Documentation
¶
Overview ¶
Package slack provides reference hook implementations that post notifications to Slack via the Slack Bot API using Block Kit formatting inside colored attachments.
The bot token is read from the SLACK_BOT_TOKEN environment variable at execution time. All hooks use changeset.Warn failure policy so Slack errors never block the changeset pipeline. When the token is empty the hooks log a warning and no-op, making them safe to register unconditionally.
Usage:
Configure(myCS).With(cfg).
WithPreHooks(slack.Notify(channel, "deploying tokens")).
WithPostHooks(slack.Result(channel))
Index ¶
Constants ¶
const ( // TokenEnvVar is the environment variable name read at hook execution time. TokenEnvVar = "SLACK_BOT_TOKEN" //nolint:gosec // env var name, not a credential )
Variables ¶
This section is empty.
Functions ¶
func Notify ¶
Notify returns a PreHook that posts a Block Kit message to channel using the Slack chat.postMessage API. The bot token is read from SLACK_BOT_TOKEN at execution time. Messages render with a blue color bar and structured fields. Uses Warn policy with a 10s timeout. No-ops when the env var is empty.
func Result ¶
Result returns a PostHook that posts changeset success/failure status to channel using the Slack chat.postMessage API with Block Kit formatting. The bot token is read from SLACK_BOT_TOKEN at execution time. Success renders with a green color bar, failure with red. Uses Warn policy with a 10s timeout. No-ops when the env var is empty.
Types ¶
This section is empty.