Documentation
¶
Index ¶
- Variables
- func AddMatcher(w io.Writer, p string) error
- func AddPath(value string) error
- func CreateTempDir() (string, error)
- func Debug(w io.Writer, message string) error
- func EncryptSecret(publicKey []byte, value string) (string, error)
- func EndGroup(w io.Writer) error
- func Error(w io.Writer, message string, properties AnnotationProperties) error
- func ExportVariable(key, value string) error
- func GetBooleanInput(name string, opts InputOptions) (bool, error)
- func GetInput(name string, opts InputOptions) (string, error)
- func GetMultilineInput(name string, opts InputOptions) ([]string, error)
- func GetState(name string) string
- func GetTempDir() (string, error)
- func Info(w io.Writer, message string) error
- func IsDebug() bool
- func IssueCommand(w io.Writer, c *Command) error
- func IssueFileCommand(p, key, value string) error
- func Notice(w io.Writer, message string, properties AnnotationProperties) error
- func RemoveMatcher(w io.Writer, owner string) error
- func SaveState(key, value string) error
- func SetFailed(w io.Writer, message string) error
- func SetOutput(key, value string) error
- func SetSecret(w io.Writer, value string) error
- func StartGroup(w io.Writer, name string) error
- func Warning(w io.Writer, message string, properties AnnotationProperties) error
- func WriteSummary(value string) error
- type AnnotationProperties
- type Command
- type CommandProperties
- type CommandProperty
- type CommandType
- type InputOptions
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPublicKey = errors.New("invalid public key: must be 32 bytes")
ErrInvalidPublicKey is returned when the provided public key is not 32 bytes long.
Functions ¶
func AddMatcher ¶
AddMatcher sends an add matcher command to the workflow writer. The problem matcher is defined by the path to the problem matcher file.
func AddPath ¶
AddPath writes a path entry to be persisted for the current GitHub Actions workflow run. It also prepends the path to the current process PATH.
func CreateTempDir ¶
CreateTempDir creates a temporary directory and returns its path.
func EncryptSecret ¶
EncryptSecret encrypts a secret value using the recipient's public key with a NaCl sealed box. This is compatible with GitHub's secret encryption which uses libsodium sealed boxes.
func Error ¶
func Error(w io.Writer, message string, properties AnnotationProperties) error
Error sends an error message to the workflow log writer.
func ExportVariable ¶
ExportVariable writes an environment variable to be persisted for the GitHub Actions workflow. It also sets the variable in the current process environment.
func GetBooleanInput ¶
func GetBooleanInput(name string, opts InputOptions) (bool, error)
GetBooleanInput gets the input value of the boolean type in the YAML 1.2 "core schema" specification. Supported boolean input list: true | True | TRUE | false | False | FALSE.
func GetInput ¶
func GetInput(name string, opts InputOptions) (string, error)
GetInput gets the value of an input. Unless TrimWhitespace is set to false in InputOptions, the value is also trimmed. Returns an empty string if the value is not defined.
func GetMultilineInput ¶
func GetMultilineInput(name string, opts InputOptions) ([]string, error)
GetMultilineInput gets the values of a multiline input. Each value is also trimmed unless TrimWhitespace is set to false.
func GetTempDir ¶
GetTempDir returns the path to the temporary directory. It checks the environment variables in the following order: 1. RUNNER_TEMP (for GitHub Actions runner) 2. TEMPDIR (for Linux) 3. TMP (for Windows) If none of these environment variables are set or point to a valid directory, an error is returned.
func Info ¶
Info writes a message directly to the workflow log writer. Unlike other log functions, info does not use a workflow command.
func IsDebug ¶
func IsDebug() bool
IsDebug returns true if the current GitHub Actions step is in debug mode.
func IssueCommand ¶
IssueCommand issues a GitHub Actions command by writing it to the provided writer.
func IssueFileCommand ¶
IssueFileCommand writes a key-value pair to a GitHub Actions environment file. It always uses heredoc format with a unique delimiter to prevent injection.
func Notice ¶
func Notice(w io.Writer, message string, properties AnnotationProperties) error
Notice sends an notice message to the workflow log writer.
func RemoveMatcher ¶
RemoveMatcher sends a remove matcher command to the workflow writer. The owner is defined in the problem matcher file that was added.
func SaveState ¶
SaveState saves state for the current action. The state can only be retrieved by this action's post job execution.
func SetFailed ¶
SetFailed sets the action status to failed by logging an error message. The caller is responsible for exiting the process with an appropriate exit code.
func SetOutput ¶
SetOutput writes an output to be persisted for the current GitHub Actions workflow step.
func StartGroup ¶
StartGroup starts a new group of messages in the workflow log writer.
func Warning ¶
func Warning(w io.Writer, message string, properties AnnotationProperties) error
Warning sends an warning message to the workflow log writer.
func WriteSummary ¶
WriteSummary writes a summary to be persisted for the current GitHub Actions workflow step.
Types ¶
type AnnotationProperties ¶
type AnnotationProperties struct {
Title string
File string
Column int
EndColumn int
Line int
EndLine int
}
AnnotationProperties represents the properties for a GitHub Actions annotation command.
func (*AnnotationProperties) GetCommandProperties ¶
func (a *AnnotationProperties) GetCommandProperties() CommandProperties
GetCommandProperties returns the annotation properties as CommandProperties suitable for use with a GitHub Actions annotation command.
type Command ¶
type Command struct {
Type CommandType
Properties CommandProperties
Message string
}
Command represents a GitHub Actions workflow command with a type, properties, and message.
func NewCommand ¶
func NewCommand(t CommandType, p CommandProperties, m string) (*Command, error)
NewCommand creates a new GitHub Actions command. It returns an error if the command type is empty.
type CommandProperties ¶
type CommandProperties []CommandProperty
CommandProperties represents a slice of properties for a GitHub Actions command.
type CommandProperty ¶
CommandProperty represents a key-value pair for a GitHub Actions command property.
type CommandType ¶
type CommandType string
CommandType represents a GitHub Actions command type.
const ( StartGroupCmd CommandType = "group" EndGroupCmd CommandType = "endgroup" DebugCmd CommandType = "debug" ErrorCmd CommandType = "error" WarningCmd CommandType = "warning" NoticeCmd CommandType = "notice" MaskCmd CommandType = "add-mask" AddMatcherCmd CommandType = "add-matcher" RemoveMatcherCmd CommandType = "remove-matcher" )
type InputOptions ¶
type InputOptions struct {
// Required indicates if the input is required.
// If required and not present, GetInput will return an error.
Required bool
// TrimWhitespace indicates if the input should be trimmed.
// If nil, the input is trimmed by default.
TrimWhitespace *bool
}
InputOptions are options for the GetInput, GetMultilineInput and GetBooleanInput functions.