Documentation
¶
Index ¶
- Constants
- Variables
- func AddPath(path string)
- func AddStepSummary(summary string)
- func Debug(message string)
- func Debugf(format string, args ...interface{})
- func DeleteStepSummary()
- func EndGroup()
- func Error(message string, properties ...AnnotationProperties)
- func Errorf(format string, args ...interface{})
- func ExportVariable(name, value string)
- func GetBoolInput(name string) bool
- func GetIDToken(audience string) (string, error)
- func GetInput(name string) (string, bool)
- func GetInputOrDefault(name, dflt string) string
- func GetMultilineInput(name string) []string
- func GetState(name string) string
- func Group(name string, f func()) func()
- func Info(message string)
- func Infof(format string, args ...interface{})
- func IsDebug() bool
- func Issue(kind string, message ...string)
- func IssueCommand(kind string, properties map[string]string, message string)
- func Notice(message string, properties ...AnnotationProperties)
- func Noticef(format string, args ...interface{})
- func ReplaceStepSummary(summary string)
- func SaveState(name, value string)
- func SetCommandEcho(enabled bool)
- func SetFailed(message string)
- func SetFailedf(format string, args ...interface{})
- func SetOutput(name, value string)
- func SetSecret(secret string)
- func SetStdout(w io.Writer)
- func StartCommands(endToken string)
- func StartGroup(name string)
- func StopCommands(endToken string)
- func ToPlatformPath(pth string) string
- func ToPosixPath(pth string) string
- func ToWin32Path(pth string) string
- func Warning(message string, properties ...AnnotationProperties)
- func Warningf(format string, args ...interface{})
- func WithoutCommands(endToken string, f func())
- type AnnotationProperties
- type File
- type PlatformDetails
- type Summary
- func (s *Summary) AddBreak() *Summary
- func (s *Summary) AddCodeBlock(code string, lang ...string) *Summary
- func (s *Summary) AddDetails(label, content string) *Summary
- func (s *Summary) AddEOL() *Summary
- func (s *Summary) AddHeading(text string, level ...int) *Summary
- func (s *Summary) AddImage(src, alt string, options ...SummaryImageOptions) *Summary
- func (s *Summary) AddLink(text, href string) *Summary
- func (s *Summary) AddList(items []string, ordered ...bool) *Summary
- func (s *Summary) AddQuote(text string, cite ...string) *Summary
- func (s *Summary) AddRaw(text string, addEOL ...bool) *Summary
- func (s *Summary) AddSeparator() *Summary
- func (s *Summary) AddTable(rows [][]SummaryTableCell) *Summary
- func (s *Summary) Clear() error
- func (s *Summary) EmptyBuffer() *Summary
- func (s *Summary) IsEmptyBuffer() bool
- func (s *Summary) Stringify() string
- func (s *Summary) Write(options ...SummaryWriteOptions) error
- type SummaryImageOptions
- type SummaryTableCell
- type SummaryWriteOptions
Constants ¶
const ( // StatusFailed is returned by Status() in case this action has been marked as failed StatusFailed = 1 // StatusSuccess is returned by Status() in case this action has not been marked as failed. By default an action is claimed as successful StatusSuccess = 0 GitHubOutputFilePathEnvName = "GITHUB_OUTPUT" GitHubStateFilePathEnvName = "GITHUB_STATE" GitHubExportEnvFilePathEnvName = "GITHUB_ENV" GitHubPathFilePathEnvName = "GITHUB_PATH" GitHubSummaryPathEnvName = "GITHUB_STEP_SUMMARY" ActionsGoJsonInputEnvName = "ACTION_GO_INPUTS" )
const ( // ActionsIDTokenRequestTokenEnvName is the env var containing the OIDC request token. ActionsIDTokenRequestTokenEnvName = "ACTIONS_ID_TOKEN_REQUEST_TOKEN" // ActionsIDTokenRequestURLEnvName is the env var containing the OIDC request URL. ActionsIDTokenRequestURLEnvName = "ACTIONS_ID_TOKEN_REQUEST_URL" )
const EOF = "\n"
Variables ¶
var Arch = jsArch()
Arch is the current CPU architecture (e.g. "x64", "arm64"). Mirrors os.arch() from Node.js — uses JavaScript naming conventions.
var IsLinux = runtime.GOOS == "linux"
IsLinux reports whether the current platform is Linux.
var IsMacOS = runtime.GOOS == "darwin"
IsMacOS reports whether the current platform is macOS.
var IsWindows = runtime.GOOS == "windows"
IsWindows reports whether the current platform is Windows.
var JobSummary = &Summary{}
JobSummary is the package-level summary instance, equivalent to core.summary in the JS toolkit.
var Platform = runtime.GOOS
Platform is the current operating system platform (e.g. "linux", "darwin", "windows"). Mirrors os.platform() from Node.js.
Functions ¶
func AddPath ¶
func AddPath(path string)
AddPath prepends inputPath to the PATH (for this action and future actions)
func AddStepSummary ¶
func AddStepSummary(summary string)
AddStepSummary adds some custom Markdown for each job so that it will be displayed on the summary page of a workflow run. You can use job summaries to display and group unique content, such as test result summaries, so that someone viewing the result of a workflow run doesn't need to go into the logs to see important information related to the run, such as failures. see: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf writes debug message to user log
func DeleteStepSummary ¶
func DeleteStepSummary()
DeleteStepSummary completely remove a summary for the current step see: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#removing-job-summaries
func Error ¶
func Error(message string, properties ...AnnotationProperties)
Error adds an error issue with optional annotation properties.
func ExportVariable ¶
func ExportVariable(name, value string)
ExportVariable sets the environment varaible name (for this action and future actions)
func GetBoolInput ¶
GetBoolInput gets the value of an input and returns whether it is a truthy value per the YAML 1.2 "core schema" specification: true | True | TRUE | false | False | FALSE. Returns false if the input is not set. Returns an error if the value is set but is not a valid boolean per the YAML spec.
func GetIDToken ¶
GetIDToken gets the JSON Web Token (JWT) for the current workflow run. audience is an optional audience for the token; pass empty string for the default. The token is automatically masked from logs.
func GetInputOrDefault ¶
GetInputOrDefault gets the value of an input. If value is not found, a default value is used
func GetMultilineInput ¶
GetMultilineInput gets the values of a multiline input. Each value is trimmed. Returns an empty slice if the input is not set.
func Group ¶
func Group(name string, f func()) func()
Group wrap an asynchronous function call in a group, all logs of the function will be collapsed after completion
func IsDebug ¶
func IsDebug() bool
IsDebug returns whether the github actions is currently under debug
func IssueCommand ¶
IssueCommand displays a typed message with properties following github actions interface. see https://github.com/actions/toolkit/blob/e69833ed16500afaa7d137a9cf6da76fb8fb54da/packages/core/src/command.ts#L19
func Notice ¶
func Notice(message string, properties ...AnnotationProperties)
Notice adds a notice issue with optional annotation properties.
func Noticef ¶
func Noticef(format string, args ...interface{})
Noticef adds a formatted notice issue
func ReplaceStepSummary ¶
func ReplaceStepSummary(summary string)
ReplaceStepSummary clear all content for the current step see: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#overwriting-job-summaries
func SaveState ¶
func SaveState(name, value string)
SaveState saves state for current action, the state can only be retrieved by this action's post job execution.
func SetCommandEcho ¶
func SetCommandEcho(enabled bool)
SetCommandEcho enables or disables the echoing of commands into stdout for the rest of the step. Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
func SetFailed ¶
func SetFailed(message string)
SetFailed sets the action status to failed and sets an error message
func SetFailedf ¶
func SetFailedf(format string, args ...interface{})
SetFailedf sets the action status to failed and sets an error message
func SetOutput ¶
func SetOutput(name, value string)
SetOutput sets the value of an output for future actions
func SetSecret ¶
func SetSecret(secret string)
SetSecret registers a secret which will get masked from logs
func StartCommands ¶
func StartCommands(endToken string)
StartCommands enables commands stopped until the endToken
func StartGroup ¶
func StartGroup(name string)
StartGroup begin an output group. Output until the next `GroupEnd` will be foldable in this group
func StopCommands ¶
func StopCommands(endToken string)
StopCommands Stops processing any workflow commands. Commands will be resumed when calling StartCommands(endToken) This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments.
func ToPlatformPath ¶
ToPlatformPath converts the given path to the platform-specific form using the OS path separator.
func ToPosixPath ¶
ToPosixPath converts the given path to POSIX form. On Windows, backslashes are replaced with forward slashes.
func ToWin32Path ¶
ToWin32Path converts the given path to Windows form. Forward slashes are replaced with backslashes.
func Warning ¶
func Warning(message string, properties ...AnnotationProperties)
Warning adds a warning issue with optional annotation properties.
func Warningf ¶
func Warningf(format string, args ...interface{})
Warningf adds a formatted warning issue
func WithoutCommands ¶
func WithoutCommands(endToken string, f func())
WithoutCommands executes the functions ensuring it does not execute any github actions commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments.
Types ¶
type AnnotationProperties ¶
type AnnotationProperties struct {
// A title for the annotation.
Title string
// The path of the file for which the annotation should be created.
File string
// The start line for the annotation.
StartLine int
// The end line for the annotation. Defaults to StartLine when StartLine is provided.
EndLine int
// The start column for the annotation. Cannot be sent when StartLine and EndLine are different values.
StartColumn int
// The end column for the annotation. Cannot be sent when StartLine and EndLine are different values.
EndColumn int
}
AnnotationProperties optional properties that can be sent with annotation commands (notice, error, and warning). See https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.
type PlatformDetails ¶
type PlatformDetails struct {
// Name is the OS display name (e.g. "Ubuntu 22.04.1 LTS", "macOS 13.0").
Name string
// Platform is the OS platform identifier (e.g. "linux", "darwin", "windows").
Platform string
// Arch is the CPU architecture using JavaScript naming (e.g. "x64", "arm64").
Arch string
// Version is the OS version string.
Version string
// IsWindows reports whether the platform is Windows.
IsWindows bool
// IsMacOS reports whether the platform is macOS.
IsMacOS bool
// IsLinux reports whether the platform is Linux.
IsLinux bool
}
PlatformDetails contains detailed information about the current operating system.
func GetDetails ¶
func GetDetails() (PlatformDetails, error)
GetDetails returns detailed platform information including OS name and version. It executes OS-specific commands to retrieve this information.
type Summary ¶
type Summary struct {
// contains filtered or unexported fields
}
Summary is a builder for GitHub Actions job summaries. Use the package-level JobSummary variable rather than constructing directly.
func (*Summary) AddCodeBlock ¶
AddCodeBlock adds an HTML code block to the buffer. lang is an optional language for syntax highlighting.
func (*Summary) AddDetails ¶
AddDetails adds a collapsible HTML details element.
func (*Summary) AddHeading ¶
AddHeading adds an HTML heading element (h1–h6). Level defaults to 1.
func (*Summary) AddImage ¶
func (s *Summary) AddImage(src, alt string, options ...SummaryImageOptions) *Summary
AddImage adds an HTML image tag.
func (*Summary) AddList ¶
AddList adds an HTML list to the buffer. ordered controls whether an <ol> or <ul> is rendered (default: unordered).
func (*Summary) AddSeparator ¶
AddSeparator adds an HTML thematic break (<hr>).
func (*Summary) AddTable ¶
func (s *Summary) AddTable(rows [][]SummaryTableCell) *Summary
AddTable adds an HTML table to the buffer. Each row is a slice of SummaryTableCell or string values.
func (*Summary) EmptyBuffer ¶
EmptyBuffer resets the buffer without writing to the file.
func (*Summary) IsEmptyBuffer ¶
IsEmptyBuffer reports whether the buffer is empty.
func (*Summary) Write ¶
func (s *Summary) Write(options ...SummaryWriteOptions) error
Write flushes the buffer to the summary file and clears the buffer. Appends by default; set options.Overwrite to replace existing content.
type SummaryImageOptions ¶
type SummaryImageOptions struct {
// Width in pixels (integer, no unit).
Width string
// Height in pixels (integer, no unit).
Height string
}
SummaryImageOptions optional attributes for summary images.
type SummaryTableCell ¶
type SummaryTableCell struct {
// Data is the cell content.
Data string
// Header renders cell as header (<th>) when true.
Header bool
// Colspan is the number of columns the cell extends (optional, default "1").
Colspan string
// Rowspan is the number of rows the cell extends (optional, default "1").
Rowspan string
}
SummaryTableCell represents a cell in a summary table.
type SummaryWriteOptions ¶
type SummaryWriteOptions struct {
// Overwrite replaces all existing content when true (default: false, appends).
Overwrite bool
}
SummaryWriteOptions controls write behavior.