ga

package module
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

README

ga

This is a test project based on go-githubactions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMask added in v0.1.2

func AddMask(p string)

AddMask adds a new field mask for the given string "p". After called, future attempts to log "p" will be replaced with "***" in log output.

func AddMatcher added in v0.1.2

func AddMatcher(p string)

AddMatcher adds a new matcher with the given file path.

func AddPath added in v0.1.2

func AddPath(p string)

AddPath adds the string "p" to the path for the invocation.

func Debugf added in v0.1.2

func Debugf(msg string, args ...interface{})

Debugf prints a debug-level message. The arguments follow the standard Printf arguments.

func EndGroup added in v0.1.2

func EndGroup()

EndGroup ends the current group.

func Errorf added in v0.1.2

func Errorf(msg string, args ...interface{})

Errorf prints a error-level message. The arguments follow the standard Printf arguments.

func Fatalf added in v0.1.2

func Fatalf(msg string, args ...interface{})

Fatalf prints a error-level message and exits. This is equivalent to Errorf followed by os.Exit(1).

func GetInput added in v0.1.2

func GetInput(i string) string

GetInput gets the input by the given name.

func Group added in v0.1.2

func Group(t string)

Group starts a new collapsable region up to the next ungroup invocation.

func Infof added in v0.1.2

func Infof(msg string, args ...interface{})

Infof prints a info-level message. The arguments follow the standard Printf arguments.

func IssueCommand added in v0.1.2

func IssueCommand(cmd *Command)

IssueCommand issues an arbitrary GitHub actions Command.

func IssueFileCommand added in v0.1.2

func IssueFileCommand(cmd *Command) error

IssueFileCommand issues a new GitHub actions Command using environment files.

func RemoveMatcher added in v0.1.2

func RemoveMatcher(o string)

RemoveMatcher removes a matcher with the given owner name.

func SaveState added in v0.1.2

func SaveState(k, v string)

SaveState saves state to be used in the "finally" post job entry point.

func SetEnv added in v0.1.2

func SetEnv(k, v string)

SetEnv sets an environment variable.

func SetOutput added in v0.1.2

func SetOutput(k, v string)

SetOutput sets an output parameter.

func Warningf added in v0.1.2

func Warningf(msg string, args ...interface{})

Warningf prints a warning-level message. The arguments follow the standard Printf arguments.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action is an internal wrapper around GitHub Actions' output and magic strings.

func New

func New() *Action

New creates a new wrapper with helpers for outputting information in GitHub actions format.

func NewWithWriter

func NewWithWriter(w io.Writer) *Action

NewWithWriter creates a wrapper using the given writer. This is useful for tests. The given writer cannot add any prefixes to the string, since GitHub requires these special strings to match a very particular format.

func WithFieldsMap added in v0.1.2

func WithFieldsMap(m map[string]string) *Action

WithFieldsMap includes the provided fields in log output. The fields in "m" are automatically converted to k=v pairs and sorted.

func WithFieldsSlice added in v0.1.2

func WithFieldsSlice(f []string) *Action

WithFieldsSlice includes the provided fields in log output. "f" must be a slice of k=v pairs. The given slice will be sorted.

func (*Action) AddMask

func (c *Action) AddMask(p string)

AddMask adds a new field mask for the given string "p". After called, future attempts to log "p" will be replaced with "***" in log output.

func (*Action) AddMatcher

func (c *Action) AddMatcher(p string)

AddMatcher adds a new matcher with the given file path.

func (*Action) AddPath

func (c *Action) AddPath(p string)

AddPath adds the string "p" to the path for the invocation. It attempts to issue a file command at first. If that fails, it falls back to the regular (now deprecated) 'add-path' command, which may stop working in the future. The deprecated fallback may be useful for users running an older version of GitHub runner.

https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

func (*Action) Debugf

func (c *Action) Debugf(msg string, args ...interface{})

Debugf prints a debug-level message. The arguments follow the standard Printf arguments.

func (*Action) EndGroup

func (c *Action) EndGroup()

EndGroup ends the current group.

func (*Action) Errorf

func (c *Action) Errorf(msg string, args ...interface{})

Errorf prints a error-level message. The arguments follow the standard Printf arguments.

func (*Action) Fatalf

func (c *Action) Fatalf(msg string, args ...interface{})

Fatalf prints a error-level message and exits. This is equivalent to Errorf followed by os.Exit(1).

func (*Action) GetBoolInput

func (c *Action) GetBoolInput(i string) (bool, error)

GetBoolInput gets input as bool by the given name.

func (*Action) GetFloat64Input

func (c *Action) GetFloat64Input(i string) (float64, error)

GetFloat64Input gets input as float64 by the given name.

func (*Action) GetInput

func (c *Action) GetInput(i string) string

GetInput gets the input by the given name.

func (*Action) GetInt64Input

func (c *Action) GetInt64Input(i string) (int64, error)

GetInt64Input gets input as int64 by the given name.

func (*Action) GetMapInput

func (c *Action) GetMapInput(i, s string) (map[string]string, error)

GetMapInput gets the input as k/v map by the given name based on provided separator.

func (*Action) GetSliceInput

func (c *Action) GetSliceInput(i string) []string

GetSliceInput gets the input as slice by the given name.

func (*Action) Group

func (c *Action) Group(t string)

Group starts a new collapsable region up to the next ungroup invocation.

func (*Action) Infof

func (c *Action) Infof(msg string, args ...interface{})

Infof prints a info-level message. The arguments follow the standard Printf arguments.

func (*Action) IssueCommand

func (c *Action) IssueCommand(cmd *Command)

IssueCommand issues a new GitHub actions Command.

func (*Action) IssueFileCommand

func (c *Action) IssueFileCommand(cmd *Command) error

IssueFileCommand issues a new GitHub actions Command using environment files.

https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files

The TypeScript equivalent function:

https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/file-command.ts#L10-L23

IssueFileCommand currently ignores the 'CommandProperties' field provided with the 'Command' argument as it's scope is unclear in the current TypeScript implementation.

func (*Action) RemoveMatcher

func (c *Action) RemoveMatcher(o string)

RemoveMatcher removes a matcher with the given owner name.

func (*Action) SaveState

func (c *Action) SaveState(k, v string)

SaveState saves state to be used in the "finally" post job entry point.

func (*Action) SetEnv

func (c *Action) SetEnv(k, v string)

SetEnv sets an environment variable. It attempts to issue a file command at first. If that fails, it falls back to the regular (now deprecated) 'set-env' command, which may stop working in the future. The deprecated fallback may be useful for users running an older version of GitHub runner.

https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

func (*Action) SetOutput

func (c *Action) SetOutput(k, v string)

SetOutput sets an output parameter.

func (*Action) Warningf

func (c *Action) Warningf(msg string, args ...interface{})

Warningf prints a warning-level message. The arguments follow the standard Printf arguments.

func (*Action) WithFieldsMap

func (c *Action) WithFieldsMap(m map[string]string) *Action

WithFieldsMap includes the provided fields in log output. The fields in "m" are automatically converted to k=v pairs and sorted.

func (*Action) WithFieldsSlice

func (c *Action) WithFieldsSlice(f []string) *Action

WithFieldsSlice includes the provided fields in log output. "f" must be a slice of k=v pairs. The given slice will be sorted. It panics if any of the string in the given slice does not construct a valid 'key=value' pair.

type Command

type Command struct {
	Name       string
	Message    string
	Properties CommandProperties
}

Command can be issued by a GitHub action by writing to `stdout` with following format.

::name key=value,key=value::message

Examples:
  ::warning::This is the message
  ::set-env name=MY_VAR::some value

func (*Command) String

func (cmd *Command) String() string

String encodes the Command to a string in the following format:

::name key=value,key=value::message

type CommandProperties

type CommandProperties map[string]string

CommandProperties is a named "map[string]string" type to hold key-value pairs passed to an actions command.

func (*CommandProperties) String

func (props *CommandProperties) String() string

String encodes the CommandProperties to a string as comma separated 'key=value' pairs. The pairs are joined in a chronological order.

Jump to

Keyboard shortcuts

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