bot

package
v0.0.0-...-05593c5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Ping event name.
	Ping = "ping"
	// IssueComment event name.
	IssueComment = "issue_comment"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot interface {
	Hook(ctx context.Context) echo.HandlerFunc
}

Bot represents the capabilities of a Gaia bot.

type Comment

type Comment struct {
	URL string `json:"url"`
}

Comment is information about the comment including the URL which has to be GET in order to retrieve the actual comment.

type Config

type Config struct {
	HookSecret string
}

Config defines configuration which this bot needs to Run.

type Dependencies

type Dependencies struct {
	Logger    zerolog.Logger
	Processor providers.Processor
	Converter providers.EnvironmentConverter
}

Dependencies defines the dependencies of this server.

type GaiaBot

type GaiaBot struct {
	Dependencies
	Config
}

GaiaBot is the bot's main handler.

func NewBot

func NewBot(cfg Config, deps Dependencies) *GaiaBot

NewBot creates a new bot to listen for PR created events.

func (*GaiaBot) Hook

func (b *GaiaBot) Hook(ctx context.Context) echo.HandlerFunc

Hook creates a hook handler.

type Hook

type Hook struct {
	Signature string
	Event     string
	ID        string
	Payload   []byte
}

Hook represent a github based webhook context.

type Issue

type Issue struct {
	PullRequest PullRequest `json:"pull_request,omitempty"`
}

Issue is information about the context of the comment. It should be checked if it's a PR.

type Payload

type Payload struct {
	Action  string  `json:"action"`
	Issue   Issue   `json:"issue"`
	Comment Comment `json:"comment"`
	Sender  Sender  `json:"sender"`
}

Payload contains information about the event like, user, commit id and so on.

type PullRequest

type PullRequest struct {
	URL string `json:"url,omitempty"`
}

PullRequest is the pull request context of an issue comment if the comment happened on a PR.

type Sender

type Sender struct {
	Login string `json:"login"`
}

Sender is the sender of the comment

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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