notifiers

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notifiers formats and sends Slack notifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape added in v1.1.0

func Escape(s string) string

Escape makes untrusted text safe to include in Slack mrkdwn, so text such as a PR title cannot mention channels or users or add links.

Types

type Options added in v1.0.0

type Options struct {
	Token    string
	Channels SlackChannels
	Messages SlackMessages
	// APIURL overrides the Slack API URL, for tests.
	APIURL string
	// GitHubWebURL is the web URL of GitHub links, such as
	// https://github.com or a GitHub Enterprise Server URL.
	GitHubWebURL string
	HTTPClient   *http.Client
}

Options configures a SlackNotifier.

type SlackChannels added in v0.16.0

type SlackChannels struct {
	Default        string
	PRBypass       string
	OktaSync       string
	OrphanedUsers  string
	SecurityAlerts string
}

SlackChannels holds channel IDs for different notification types. Empty values fall back to the default channel.

type SlackMessages added in v0.19.0

type SlackMessages struct {
	// PRBypassFooterNote is Slack mrkdwn written by the operator, so it is
	// sent as is.
	PRBypassFooterNote string
}

SlackMessages holds optional custom text for notifications. Empty values are left out.

type SlackNotifier

type SlackNotifier struct {
	// contains filtered or unexported fields
}

SlackNotifier sends formatted messages to Slack channels.

func New added in v1.0.0

func New(opts Options) *SlackNotifier

New creates a SlackNotifier.

func (*SlackNotifier) NotifyOktaSync

func (s *SlackNotifier) NotifyOktaSync(ctx context.Context, reports []*domain.SyncReport, githubOrg string) error

NotifyOktaSync sends a Slack notification with Okta sync results.

func (*SlackNotifier) NotifyOrphanedUsers

func (s *SlackNotifier) NotifyOrphanedUsers(ctx context.Context, report *domain.OrphanedUsersReport) error

NotifyOrphanedUsers sends a Slack notification about organization members not in any synced teams.

func (*SlackNotifier) NotifyPRBypass

func (s *SlackNotifier) NotifyPRBypass(ctx context.Context, result *domain.PRComplianceResult, repoFullName string) error

NotifyPRBypass sends a Slack notification when a PR was merged without meeting its branch's requirements.

func (*SlackNotifier) NotifySecurityAlerts added in v0.22.0

func (s *SlackNotifier) NotifySecurityAlerts(ctx context.Context, report *domain.SecurityAlertsReport, githubOrg string) error

NotifySecurityAlerts sends a Slack notification summarizing stale open security alerts across the organization.

func (*SlackNotifier) ReplyToCommand added in v1.1.0

func (s *SlackNotifier) ReplyToCommand(ctx context.Context, responseURL, text string) error

ReplyToCommand answers a slash command through its response URL, which must be a Slack URL, so a forged job cannot make the app send requests elsewhere.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL