api

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReleaseNoteLabelNeeded defines the label used when a missing release-note label is blocking the
	// merge.
	ReleaseNoteLabelNeeded = "do-not-merge/release-note-label-needed"
)

Variables

This section is empty.

Functions

func Register

func Register(rootRouter *mux.Router, context *Context)

Register registers the API endpoints on the given router.

Types

type Actions

type Actions interface {
	HandleReleaseNotesPR(c *Context, pr *github.PullRequestEvent)
}

Actions describes the interface for actions.

type Context

type Context struct {
	GitHub    GitHub
	Actions   Actions
	RequestID string
	Logger    logrus.FieldLogger
}

Context provides the API with all necessary data and interfaces for responding to requests.

It is cloned before each request, allowing per-request changes such as logger annotations.

func (*Context) Clone

func (c *Context) Clone() *Context

Clone creates a shallow copy of context, allowing clones to apply per-request changes.

type GitHub

type GitHub interface {
	ValidateSignature(receivedHash []string, bodyBuffer []byte) error
	CreateComment(org, repo string, number int, comment string) error
	CreateLabel(org, repo string, label github.Label) error
	AddLabels(org, repo string, number int, labels []string) error
	RemoveLabel(org, repo string, number int, label string) error
	GetIssueLabels(org, repo string, number int) ([]*github.Label, error)
	ListIssueComments(org, repo string, number int) ([]*github.IssueComment, error)
	GetComments(org, repo string, number int) ([]*github.IssueComment, error)
	IsMember(org, repo string) (bool, error)
	SetStatus(org, repo, sha, state, message string) error
	GetPullRequest(org, repo string, number int) (*github.PullRequest, error)
	ListRepoLabels(org, repo string) ([]*github.Label, error)
}

GitHub describes the interface required to persist changes made via API requests.

Jump to

Keyboard shortcuts

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