Documentation
¶
Index ¶
- Constants
- Variables
- func APIURLFromBaseURL(base *url.URL) (*url.URL, error)
- func Expand(b []byte, mapping ExpandFunc) (p []byte)
- func ExpandString(s string, mapping ExpandFunc) string
- func GetGitHubAPIURL() *url.URL
- func GetGitHubServerURL() *url.URL
- func GetGitHubURL() *url.URL
- func GetGraphQLURL() *url.URL
- func GraphQLURLFromBaseURL(base *url.URL) (*url.URL, error)
- func IsErrNotAWorkflowCommand(err error) bool
- func IsErrNotAnAction(err error) bool
- func NewWorkflowCommandWriter(callback func(*WorkflowCommand) []byte, w io.Writer) io.Writer
- func OpenDirectoryMetadata(dir string) (_ io.Reader, err error)
- func OpenUsesMetadata(uses *Uses) (io.Reader, error)
- func WithGlobalContext(ctx context.Context, globalContext *GlobalContext) context.Context
- type CheckoutOpts
- type ExpandFunc
- type Expander
- type GitHubContext
- type GlobalContext
- type JobContext
- type JobContextContainer
- type JobContextService
- type Metadata
- type MetadataInput
- type MetadataOutput
- type MetadataRuns
- type NeedContext
- type RunnerContext
- type Step
- type StepContext
- type Uses
- type WorkflowCommand
Constants ¶
View Source
const ( ArchX86 = "X86" ArchX64 = "X64" ArchARM = "ARM" ArchARM64 = "ARM64" )
View Source
const ( DefaultBranch = "main" DefaultRemote = "origin" )
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 ( RunsUsingDockerfileImage = "Dockerfile" RunsUsingDockerImagePrefix = "docker://" RunsUsingDocker = "docker" RunsUsingComposite = "composite" RunsUsingNode12 = "node12" RunsUsingNode16 = "node16" )
View Source
const ( OSLinux = "Linux" OSWindows = "Windows" OSDarwin = "macOS" )
View Source
const ( RefTypeTag = "tag" RefTypeBranch = "branch" )
View Source
const ( SecretActionsStepDebug = "ACTIONS_STEP_DEBUG" SecretActionsRunnerDebug = "ACTIONS_RUNNER_DEBUG" SecretDebugValue = "true" )
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 ( ErrNotAnAction = errors.New("action.yaml/action.yml not found") ErrNotAWorkflowCommand = errors.New("not a workflow command") )
View Source
var ActionYAMLFilenames = []string{"action.yml", "action.yaml"}
View Source
var ErrMissingRequiredInput = errors.New("required input missing")
Functions ¶
func Expand ¶
func Expand(b []byte, mapping ExpandFunc) (p []byte)
func ExpandString ¶
func ExpandString(s string, mapping ExpandFunc) string
func GetGitHubAPIURL ¶
func GetGitHubServerURL ¶
func GetGitHubURL ¶
func GetGraphQLURL ¶
func IsErrNotAnAction ¶
func WithGlobalContext ¶
func WithGlobalContext(ctx context.Context, globalContext *GlobalContext) context.Context
Types ¶
type ExpandFunc ¶
type Expander ¶
type Expander struct {
ExpandFunc
}
func NewExpander ¶
func NewExpander(f ExpandFunc) *Expander
func (*Expander) ExpandString ¶
type GitHubContext ¶
type GitHubContext struct {
Action string `json:"action,omitempty"`
ActionPath string `json:"action_path,omitempty"`
Actor string `json:"actor,omitempty"`
BaseRef string `json:"base_ref,omitempty"`
Event string `json:"event,omitempty"`
EventName string `json:"event_name,omitempty"`
EventPath string `json:"event_path,omitempty"`
HeadRef string `json:"head_ref,omitempty"`
Job string `json:"job,omitempty"`
Ref string `json:"ref,omitempty"`
RefName string `json:"ref_name,omitempty"`
RefProtected bool `json:"ref_protected,omitempty"`
RefType string `json:"ref_type,omitempty"`
Repository string `json:"repository,omitempty"`
RepositoryOwner string `json:"repository_owner,omitempty"`
RunID string `json:"run_id,omitempty"`
RunNumber int64 `json:"run_number,omitempty"`
RunAttempt int64 `json:"run_attempt,omitempty"`
ServerURL string `json:"server_url,omitempty"`
Sha string `json:"sha,omitempty"`
Token string `json:"token,omitempty"`
Workflow string `json:"workflow,omitempty"`
Workspace string `json:"workspace,omitempty"`
}
func (*GitHubContext) GetString ¶
func (c *GitHubContext) GetString(key string) string
type GlobalContext ¶
type GlobalContext struct {
GitHubContext *GitHubContext `json:"git_hub_context,omitempty"`
EnvContext map[string]string `json:"env_context,omitempty"`
JobContext *JobContext `json:"job_context,omitempty"`
StepsContext map[string]*StepContext `json:"steps_context,omitempty"`
RunnerContext *RunnerContext `json:"runner_context,omitempty"`
InputsContext map[string]string `json:"inputs_context,omitempty"`
SecretsContext map[string]string `json:"secrets_context,omitempty"`
NeedsContext map[string]*NeedContext `json:"needs_context,omitempty"`
}
func GlobalContextFrom ¶
func GlobalContextFrom(ctx context.Context) (globalContext *GlobalContext, ok bool)
func NewGlobalContextFromEnv ¶
func NewGlobalContextFromEnv() *GlobalContext
func NewGlobalContextFromPath ¶
func NewGlobalContextFromPath(ctx context.Context, path string) (*GlobalContext, error)
func (*GlobalContext) AddEnv ¶
func (c *GlobalContext) AddEnv(env map[string]string)
func (*GlobalContext) Env ¶
func (c *GlobalContext) Env() []string
func (*GlobalContext) GetString ¶
func (c *GlobalContext) GetString(key string) string
type JobContext ¶
type JobContext struct {
Container *JobContextContainer `json:"container,omitempty"`
Services map[string]*JobContextService `json:"services,omitempty"`
Status string `json:"status,omitempty"`
}
func (*JobContext) GetString ¶
func (c *JobContext) GetString(key string) string
type JobContextContainer ¶
type JobContextService ¶
type Metadata ¶
type Metadata struct {
Name string `json:"name,omitempty"`
Author string `json:"author,omitempty"`
Description string `json:"description,omitempty"`
Inputs map[string]*MetadataInput `json:"inputs,omitempty"`
Output map[string]*MetadataOutput `json:"output,omitempty"`
Runs *MetadataRuns `json:"runs,omitempty"`
}
func CheckoutUses ¶
func GetUsesMetadata ¶
func (*Metadata) InputsFromWith ¶
func (*Metadata) IsComposite ¶
func (*Metadata) IsDockerfile ¶
type MetadataInput ¶
type MetadataOutput ¶
type MetadataOutput struct {
Description string `json:"description,omitempty"`
}
type MetadataRuns ¶
type MetadataRuns struct {
Plugin string `json:"plugin,omitempty"`
Using string `json:"using,omitempty"`
Pre string `json:"pre,omitempty"`
Main string `json:"main,omitempty"`
Post string `json:"post,omitempty"`
Image string `json:"image,omitempty"`
PreEntrypoint string `json:"pre_entrypoint,omitempty"`
Entrypoint string `json:"entrypoint,omitempty"`
PostEntrypoint string `json:"post_entrypoint,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
Steps []*Step `json:"steps,omitempty"`
}
type NeedContext ¶
func (*NeedContext) GetString ¶
func (c *NeedContext) GetString(key string) string
type RunnerContext ¶
type RunnerContext struct {
Name string `json:"name,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
Temp string `json:"temp,omitempty"`
ToolCache string `json:"tool_cache,omitempty"`
}
func (*RunnerContext) GetString ¶
func (c *RunnerContext) GetString(key string) string
type Step ¶
type Step struct {
Shell string `json:"shell,omitempty"`
If string `json:"if,omitempty"`
Name string `json:"name,omitempty"`
ID string `json:"id,omitempty"`
Env map[string]string `json:"env,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
Uses string `json:"uses,omitempty"`
With map[string]string `json:"with,omitempty"`
Run string `json:"run,omitempty"`
}
type StepContext ¶
type StepContext struct {
Outputs map[string]string `json:"outputs,omitempty"`
Conclusion string `json:"conclusion,omitempty"`
Outcome string `json:"outcome,omitempty"`
}
func (*StepContext) GetString ¶
func (c *StepContext) GetString(key string) string
type Uses ¶
func (*Uses) GetActionPath ¶
func (*Uses) GetRepository ¶
func (*Uses) MarshalJSON ¶
func (*Uses) UsesString ¶
type WorkflowCommand ¶
type WorkflowCommand struct {
Command string `json:"command,omitempty"`
Parameters map[string]string `json:"parameters,omitempty"`
Value string `json:"value,omitempty"`
}
func ParseWorkflowCommand ¶
func ParseWorkflowCommand(b []byte) (*WorkflowCommand, error)
func ParseWorkflowCommandString ¶
func ParseWorkflowCommandString(workflowCommand string) (*WorkflowCommand, error)
TODO regexp.
func (*WorkflowCommand) GetName ¶
func (c *WorkflowCommand) GetName() string
func (*WorkflowCommand) GoString ¶
func (c *WorkflowCommand) GoString() string
func (*WorkflowCommand) String ¶
func (c *WorkflowCommand) String() string
Click to show internal directories.
Click to hide internal directories.