github

package module
v0.0.0-...-ae36d4e Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatePending = State("pending")
	StateSuccess = State("success")
	StateError   = State("error")
	StateFailure = State("failure")
)

The list of valid states for Github Status API requests

Variables

This section is empty.

Functions

func MakeStatusMessage

func MakeStatusMessage(context string, state State, URL, description string) message.Composer

MakeStatusMessage creates a composer for sending payloads to the Github Status API without setting a priority

func MakeStatusMessageWithRepo

func MakeStatusMessageWithRepo(status Status) message.Composer

MakeStatusMessageWithRepo creates a composer for sending payloads to the Github Status API, with the repository and ref stored in the composer

func NewCommentSender

func NewCommentSender(name string, issueID int, opts *GithubOptions) (send.Sender, error)

NewCommentSender creates a new Sender implementation that adds a comment to a github issue (or pull request) for every log message sent.

Specify the credentials to use the GitHub via the GithubOptions structure, and the issue number as an argument to the constructor.

func NewIssueSender

func NewIssueSender(name string, opts *GithubOptions) (send.Sender, error)

NewIssuesLogger builds a sender implementation that creates a new issue in a Github Project for each log message.

func NewStatusMessage

func NewStatusMessage(p level.Priority, context string, state State, URL, description string) message.Composer

NewStatusMessage creates a composer for sending payloads to the Github Status API.

func NewStatusMessageWithRepo

func NewStatusMessageWithRepo(p level.Priority, status Status) message.Composer

NewStatusMessageWithRepo creates a composer for sending payloads to the Github Status API, with the repository and ref stored in the composer

func NewStatusSender

func NewStatusSender(name string, opts *GithubOptions, ref string) send.Sender

NewStatusSender returns a Sender to send payloads to the Github Status API. Statuses will be attached to the given ref.

Types

type GithubOptions

type GithubOptions struct {
	Account string
	Repo    string
	Token   string
}

GithubOptions contains information about a github account and repository, used in the GithubIssuesLogger and the GithubCommentLogger Sender implementations.

type State

type State string

State represents the 4 valid states for the Github State API in a safer way

type Status

type Status struct {
	Owner string `bson:"owner,omitempty" json:"owner,omitempty" yaml:"owner,omitempty"`
	Repo  string `bson:"repo,omitempty" json:"repo,omitempty" yaml:"repo,omitempty"`
	Ref   string `bson:"ref,omitempty" json:"ref,omitempty" yaml:"ref,omitempty"`

	Context     string `bson:"context" json:"context" yaml:"context"`
	State       State  `bson:"state" json:"state" yaml:"state"`
	URL         string `bson:"url" json:"url" yaml:"url"`
	Description string `bson:"description" json:"description" yaml:"description"`
}

Status is a message to be posted to Github's Status API

func (*Status) Valid

func (p *Status) Valid() bool

Valid returns true if the message is well formed

Jump to

Keyboard shortcuts

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