actions

package
v0.0.0-...-7391911 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package actions decodes the Actions context to interpret the user's intent and act.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionEnvironment

type ActionEnvironment interface {
	// contains filtered or unexported methods
}

ActionEnvironment smuggles *Environment out of structs that embed one.

type Environment

type Environment struct {
	GitHubEventName  string `env:"GITHUB_EVENT_NAME"`
	GitHubEventPath  string `env:"GITHUB_EVENT_PATH"`
	GitHubRepository string `env:"GITHUB_REPOSITORY"`

	InputLogLevel string `env:"INPUT_LOG_LEVEL" envDefault:"info"`
}

Environment includes Actions environment https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables

func (*Environment) LogLevel

func (e *Environment) LogLevel() logrus.Level

LogLevel returns the logrus level

func (*Environment) ParseEvent

func (e *Environment) ParseEvent() (interface{}, error)

ParseEvent returns deserialized GitHub webhook payload, or an error.

type Handlers

type Handlers struct {
	IssueComment       func(context.Context, *github.IssueCommentEvent) error
	PullRequest        func(context.Context, *github.PullRequestEvent) error
	Release            func(context.Context, *github.ReleaseEvent) error
	RepositoryDispatch func(context.Context, *github.RepositoryDispatchEvent) error
	Schedule           func(context.Context) error
	WorkflowDispatch   func(context.Context) error
}

func (*Handlers) Handle

func (h *Handlers) Handle(ctx context.Context, env *Environment) error

Handle invokes the appropriate handler for an given actions Environment.

func (*Handlers) ParseAndHandle

func (h *Handlers) ParseAndHandle(ctx context.Context, env interface{}) error

ParseAndHandle hydrates an `env:""` annotated struct, then Handle()s

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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