Documentation ¶
Index ¶
- Constants
- Variables
- func ErrIsNotAWorkflowCommand(err error) bool
- func Expand(s string, mapping ExpandFunc) string
- func ExpandBytes(b []byte, mapping ExpandFunc) (p []byte)
- func NewWorkflowCommandWriter(callback func(*WorkflowCommand) []byte, w io.Writer) io.Writer
- func WithInsecure(co *cloneOpts) error
- type Arch
- type CloneOpt
- type CtxOpt
- type ExpandFunc
- type Expander
- type GitHubContext
- type GlobalContext
- type Job
- type JobContext
- type Metadata
- type NeedsContext
- type OS
- type RefType
- type RunnerContext
- type Step
- type StepsContext
- type Workflow
- type WorkflowCommand
Constants ¶
View Source
const ( EnvVarCI = "CI" EnvVarWorkflow = "GITHUB_WORKFLOW" EnvVarRunID = "GITHUB_RUN_ID" EnvVarRunNumber = "GITHUB_RUN_NUMBER" EnvVarRunAttempt = "GITHUB_RUN_ATTEMPT" EnvVarJob = "GITHUB_JOB" EnvVarAction = "GITHUB_ACTION" EnvVarActionPath = "GITHUB_ACTION_PATH" EnvVarActions = "GITHUB_ACTIONS" EnvVarActor = "GITHUB_ACTOR" EnvVarRepository = "GITHUB_REPOSITORY" EnvVarEventName = "GITHUB_EVENT_NAME" EnvVarEventPath = "GITHUB_EVENT_PATH" EnvVarWorkspace = "GITHUB_WORKSPACE" EnvVarSha = "GITHUB_SHA" EnvVarRef = "GITHUB_REF" EnvVarRefName = "GITHUB_REF_NAME" EnvVarRefProtected = "GITHUB_REF_PROTECTED" EnvVarRefType = "GITHUB_REF_TYPE" EnvVarHeadRef = "GITHUB_HEAD_REF" EnvVarBaseRef = "GITHUB_BASE_REF" EnvVarServerURL = "GITHUB_SERVER_URL" EnvVarAPIURL = "GITHUB_API_URL" EnvVarGraphQLURL = "GITHUB_GRAPHQL_URL" EnvVarRunnerName = "RUNNER_NAME" EnvVarRunnerOS = "RUNNER_OS" EnvVarRunnerArch = "RUNNER_ARCH" EnvVarRunnerTemp = "RUNNER_TEMP" EnvVarRunnerToolCache = "RUNNER_TOOL_CACHE" EnvVarEnv = "GITHUB_ENV" EnvVarPath = "GITHUB_PATH" EnvVarToken = "GITHUB_TOKEN" //nolint:gosec EnvVarRepositoryOwner = "GITHUB_REPOSITORY_OWNER" EnvVarRetentionDays = "GITHUB_RETENTION_DAYS" EnvVarStepSummary = "GITHUB_STEP_SUMMARY" EnvVarActionRepository = "GITHUB_ACTION_REPOSITORY" )
View Source
const ( RunsUsingDockerImagePrefix = "docker://" RunsUsingDocker = "docker" RunsUsingNode12 = "node12" RunsUsingNode16 = "node16" RunsUsingComposite = "composite" )
View Source
const ( CommandDebug = "debug" CommandGroup = "group" CommandEndGroup = "endgroup" CommandSaveState = "save-state" CommandSetOutput = "set-output" CommandNotice = "notice" CommandWarning = "warning" CommandError = "error" CommandAddMask = "add-mask" CommandEcho = "echo" CommandStopCommands = "stop-commands" )
Variables ¶
View Source
var ErrNotAWorkflowCommand = errors.New("not a workflow command")
View Source
var ErrNotAnAction = errors.New("action.yaml/action.yml not found")
Functions ¶
func Expand ¶
func Expand(s string, mapping ExpandFunc) string
func ExpandBytes ¶
func ExpandBytes(b []byte, mapping ExpandFunc) (p []byte)
func WithInsecure ¶
func WithInsecure(co *cloneOpts) error
Types ¶
type CtxOpt ¶
type CtxOpt func(*GlobalContext) error
func WithInputs ¶
func WithJobName ¶
func WithSecrets ¶
func WithWorkflowName ¶
type ExpandFunc ¶
type Expander ¶
type Expander struct {
ExpandFunc ExpandFunc
}
func NewExpander ¶
func NewExpander(f ExpandFunc) *Expander
func (*Expander) ExpandBytes ¶
type GitHubContext ¶
type GitHubContext struct { Action string ActionPath string Actor string BaseRef string Event string EventName string EventPath string HeadRef string Job string Ref string RefName string RefProtected bool RefType RefType Repository string RepositoryOwner string RunID string RunNumber int RunAttempt int ServerURL *url.URL Sha string Token string Workflow string Workspace string }
GitHubContext represents the GitHub Context https://docs.github.com/en/actions/learn-github-actions/Context#github-context
func (*GitHubContext) GetString ¶
func (c *GitHubContext) GetString(key string) string
type GlobalContext ¶
type GlobalContext struct { GitHubContext *GitHubContext EnvContext map[string]string JobContext *JobContext StepsContext map[string]*StepsContext RunnerContext *RunnerContext InputsContext map[string]string SecretsContext map[string]string NeedsContext map[string]*NeedsContext }
func EmptyContext ¶
func EmptyContext(opts ...CtxOpt) *GlobalContext
func NewContext ¶
func NewContext(opts ...CtxOpt) (*GlobalContext, error)
func NewContextFromPath ¶
func (*GlobalContext) AddEnv ¶
func (c *GlobalContext) AddEnv(env map[string]string)
func (*GlobalContext) EnvArr ¶
func (c *GlobalContext) EnvArr() []string
func (*GlobalContext) EnvMap ¶
func (c *GlobalContext) EnvMap() map[string]string
func (*GlobalContext) GetString ¶
func (c *GlobalContext) GetString(key string) string
type Job ¶
type Job struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Permissions interface{} `json:"permissions,omitempty" yaml:"permissions,omitempty"` Needs interface{} `json:"needs,omitempty" yaml:"needs,omitempty"` If interface{} `json:"if,omitempty" yaml:"if,omitempty"` RunsOn string `json:"runs-on,omitempty" yaml:"runs-on,omitempty"` Environment *struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` URL *url.URL `json:"url,omitempty" yaml:"url,omitempty"` } `json:"environment,omitempty" yaml:"environment,omitempty"` Concurrency interface{} `json:"concurrency,omitempty" yaml:"concurrency,omitempty"` Outputs map[string]string `json:"outputs,omitempty" yaml:"outputs,omitempty"` Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` Container interface{} `json:"container,omitempty" yaml:"container,omitempty"` Steps []*Step `json:"steps,omitempty" yaml:"steps,omitempty"` }
type JobContext ¶
type JobContext struct { Container *struct { ID string Network string } Services map[string]struct { ID string Network string // not sure if this is the correct representation Ports map[string]string } Status string }
func (*JobContext) GetString ¶
func (c *JobContext) GetString(key string) string
type Metadata ¶
type Metadata struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Author string `json:"author,omitempty" yaml:"author,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Inputs map[string]*struct { Description string `json:"input,omitempty" yaml:"input,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` DeprecationMessage string `json:"deprecationMessage,omitempty" yaml:"deprecationMessage,omitempty"` } `json:"inputs,omitempty" yaml:"inputs,omitempty"` Outputs map[string]*struct { Description string `json:"output,omitempty" yaml:"output,omitempty"` } `json:"outputs,omitempty" yaml:"outputs,omitempty"` Runs *struct { Plugin string `json:"plugin,omitempty" yaml:"plugin,omitempty"` Using string `json:"using,omitempty" yaml:"using,omitempty"` Pre string `json:"pre,omitempty" yaml:"pre,omitempty"` Main string `json:"main,omitempty" yaml:"main,omitempty"` Post string `json:"post,omitempty" yaml:"post,omitempty"` Image string `json:"image,omitempty" yaml:"image,omitempty"` PreEntrypoint string `json:"pre-entrypoint,omitempty" yaml:"pre-entrypoint,omitempty"` Entrypoint string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` PostEntrypoint string `json:"post-entrypoint,omitempty" yaml:"post-entrypoint,omitempty"` Args []string `json:"args,omitempty" yaml:"args,omitempty"` Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` Steps []*Step `json:"steps,omitempty" yaml:"steps,omitempty"` } `json:"runs,omitempty" yaml:"runs,omitempty"` }
func CloneContext ¶
func (*Metadata) IsComposite ¶
func (*Metadata) WithFromInputs ¶
type NeedsContext ¶
func (*NeedsContext) GetString ¶
func (c *NeedsContext) GetString(key string) string
type RunnerContext ¶
func (*RunnerContext) GetString ¶
func (c *RunnerContext) GetString(key string) string
type Step ¶
type Step struct { Shell string `json:"shell,omitempty" yaml:"shell,omitempty"` If string `json:"if,omitempty" yaml:"if,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` ID string `json:"id,omitempty" yaml:"id,omitempty"` Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"` WorkingDirectory string `json:"working-directory,omitempty" yaml:"working-directory,omitempty"` Uses string `json:"uses,omitempty" yaml:"uses,omitempty"` With map[string]string `json:"with,omitempty" yaml:"with,omitempty"` Run string `json:"run,omitempty" yaml:"run,omitempty"` }
type StepsContext ¶
func (*StepsContext) GetString ¶
func (c *StepsContext) GetString(key string) string
type WorkflowCommand ¶
func ParseStringWorkflowCommand ¶
func ParseStringWorkflowCommand(s string) (*WorkflowCommand, error)
func ParseWorkflowCommand ¶
func ParseWorkflowCommand(b []byte) (*WorkflowCommand, error)
func (*WorkflowCommand) GetName ¶
func (c *WorkflowCommand) GetName() string
func (*WorkflowCommand) GoString ¶
func (c *WorkflowCommand) GoString() string
func (*WorkflowCommand) String ¶
func (c *WorkflowCommand) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.