action

package
v0.0.0-...-81db211 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPullRequestEventRequired = errors.New("a pull request event is required")
	ErrNoReleaseNoteFound       = errors.New("no release-note code block found")
)

Functions

func Log

func Log(msg string, a ...interface{})

Log will write a log entry to stdout.

func LogDebug

func LogDebug(msg string, a ...interface{})

LogDebug will write a debug message command to stdout.

func LogError

func LogError(msg string, a ...interface{})

LogError will write a error message command to stdout.

func LogErrorAndExit

func LogErrorAndExit(msg string, a ...interface{})

LogErrorAndExit will write a error message command to stdout and exit with a non-zero exit code.

func LogWarning

func LogWarning(msg string, a ...interface{})

LogWarning will write a warning message command to stdout.

Types

type Context

type Context struct {
	Repository string `json:"repo" env:"GITHUB_REPOSITORY"`
	SHA        string `json:"sha" env:"GITHUB_SHA"`
	Ref        string `json:"ref" env:"GITHUB_REF"`
	EventName  string `json:"eventName" env:"GITHUB_EVENT_NAME"`
	Workflow   string `json:"workflow" env:"GITHUB_WORKFLOW"`
	Action     string `json:"action" env:"GITHUB_ACTION"`
	Actor      string `json:"actor" env:"GITHUB_ACTOR"`
	Job        string `json:"job" env:"GITHUB_JOB"`
	RunNumber  int    `json:"runNumber" env:"GITHUB_RUN_NUMBER"`
	RunID      int    `json:"runID" env:"GITHUB_RUN_ID"`
	APIURL     string `json:"apiUrl" env:"GITHUB_API_URL" envDefault:"ttps://api.github.com"`
	ServerURL  string `json:"serverUrl" env:"GITHUB_SERVER_URL" envDefault:"https://github.com"`
	GraphQLUrl string `json:"graphqlUrl" env:"GITHUB_GRAPHQL_URL " envDefault:"https://api.github.com/graphql"`
	Event      *Event `json:"payload"`
	EventPath  string `env:"GITHUB_EVENT_PATH"`
}

Context represents the trigger event context.

func NewContextFromEnv

func NewContextFromEnv() (*Context, error)

NewContextFromEnv creates a new context from environment variables.

type Event

type Event struct {
	Action string `json:"action"`
	After  string `json:"after"`
	Before string `json:"before"`
	Number int    `json:"number"`

	PullRequest *PullRequest `json:"pull_request"`
}

Event represents the GitHub Actions event trigger.

type PullRequest

type PullRequest struct {
	Body         string    `json:"body"`
	ChangedFiles int       `json:"changed_files"`
	Commits      int       `json:"commits"`
	CreatedAt    time.Time `json:"created_at"`
	Draft        bool      `json:"draft"`
	HTMLURL      string    `json:"html_url"`
	ID           int       `json:"id"`
	Number       int       `json:"number"`
	Title        string    `json:"title"`
}

PullRequest represents the payload for a pull request GitHub Actions event. NOTE: not all the fields have been added.

type ReleaseNoteAction

type ReleaseNoteAction interface {
	ReleaseNoteExists(ctx *Context) (bool, error)
}

ReleaseNoteAction represents the interface for a action to check for a release note.

func New

func New() ReleaseNoteAction

New creates a new instance of the release note action.

Jump to

Keyboard shortcuts

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