Documentation ¶
Index ¶
- Constants
- func Serve(b Bot)
- type Bot
- type BotOptions
- type EventHandlerFunc
- type EventType
- type GitHubClient
- func (c GitHubClient) AddLabel(ctx context.Context, pr *github.PullRequest, label string) error
- func (c GitHubClient) Client() *github.Client
- func (c GitHubClient) Close(ctx context.Context) error
- func (c GitHubClient) GetWorkflowRunLogs(ctx context.Context, wre github.WorkflowRunEvent) ([]byte, error)
- func (c GitHubClient) GetWorkloadRunPullRequestNumber(ctx context.Context, wre github.WorkflowRunEvent) (int, error)
- func (c GitHubClient) RemoveLabel(ctx context.Context, pr *github.PullRequest, label string) error
- func (c GitHubClient) SetComment(ctx context.Context, pr *github.PullRequest, botName, content string) error
- type PullRequestHandler
- type WorkflowRunHandler
Constants ¶
View Source
const ( ContextKeyAttributes contextKey = "ce-attributes" ContextKeyType contextKey = "ce-type" )
Define constants for the keys to use with context.WithValue.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bot ¶
type Bot struct { Name string Handlers map[EventType]EventHandlerFunc }
func NewBot ¶ added in v0.6.0
func NewBot(name string, opts ...BotOptions) Bot
func (*Bot) RegisterHandler ¶ added in v0.6.0
func (b *Bot) RegisterHandler(handler EventHandlerFunc)
type BotOptions ¶ added in v0.6.0
type BotOptions func(*Bot)
func BotWithHandler ¶ added in v0.6.0
func BotWithHandler(handler EventHandlerFunc) BotOptions
type EventHandlerFunc ¶ added in v0.6.0
type EventHandlerFunc interface {
EventType() EventType
}
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
func NewGitHubClient ¶
func NewGitHubClient(ctx context.Context, org, repo, policyName string) GitHubClient
NewGitHubClient creates a new GitHub client, using a new token from OctoSTS, for the given org, repo and policy name.
A new token is created for each client, and is not refreshed. It can be revoked with Close.
func (GitHubClient) AddLabel ¶
func (c GitHubClient) AddLabel(ctx context.Context, pr *github.PullRequest, label string) error
func (GitHubClient) Client ¶
func (c GitHubClient) Client() *github.Client
func (GitHubClient) GetWorkflowRunLogs ¶ added in v0.6.4
func (c GitHubClient) GetWorkflowRunLogs(ctx context.Context, wre github.WorkflowRunEvent) ([]byte, error)
func (GitHubClient) GetWorkloadRunPullRequestNumber ¶ added in v0.6.4
func (c GitHubClient) GetWorkloadRunPullRequestNumber(ctx context.Context, wre github.WorkflowRunEvent) (int, error)
func (GitHubClient) RemoveLabel ¶
func (c GitHubClient) RemoveLabel(ctx context.Context, pr *github.PullRequest, label string) error
func (GitHubClient) SetComment ¶
func (c GitHubClient) SetComment(ctx context.Context, pr *github.PullRequest, botName, content string) error
type PullRequestHandler ¶ added in v0.6.0
type PullRequestHandler func(ctx context.Context, pre github.PullRequestEvent, pr *github.PullRequest) error
func (PullRequestHandler) EventType ¶ added in v0.6.0
func (r PullRequestHandler) EventType() EventType
type WorkflowRunHandler ¶ added in v0.6.0
type WorkflowRunHandler func(ctx context.Context, wre github.WorkflowRunEvent, wr *github.WorkflowRun) error
func (WorkflowRunHandler) EventType ¶ added in v0.6.0
func (r WorkflowRunHandler) EventType() EventType
Click to show internal directories.
Click to hide internal directories.