core

package
v0.0.0-...-27646ee Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 4 Imported by: 0

README

go-action-toolkit/core

Core functions for setting results, logging, registering secrets and exporting variables across actions

This is Go port of @actions/core including modification (e.g. Add option to logging command to spedcify file,line,col).

document: GoDoc

Documentation

Overview

Package core is Go port of @actions/core. Core functions for setting results, logging, registering secrets and exporting variables across actions.

https://github.com/actions/toolkit/tree/master/packages/core

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPath

func AddPath(inputPath string)

Prepends inputPath to the PATH (for this action and future actions).

func Debug

func Debug(mes string, option *LogOption)

Writes debug message to user log.

You can optionally provide a filename (file), line number (line), and column (col) number as LogOption where the warning occurred.

func EndGroup

func EndGroup()

End an output group.

func Error

func Error(mes string, option *LogOption)

Adds an error issue.

You can optionally provide a filename (file), line number (line), and column (col) number as LogOption where the warning occurred.

func ExportVariable

func ExportVariable(name, value string)

Sets env variable for this action and future actions in the job.

func GetInput

func GetInput(name string) string

Gets the value of an input. The value is also trimmed. It will return empty string if input is not present.

func GetState

func GetState(name string) string

Gets the value of an state set by this action's main execution.

func Info

func Info(mes string)

Writes info to log.

func SaveState

func SaveState(name, value string)

Saves state for current action, the state can only be retrieved by this action's post job execution.

func SetOutput

func SetOutput(name, value string)

Sets the value of an output.

func SetSecret

func SetSecret(value string)

Registers a secret which will get masked from logs.

func StartGroup

func StartGroup(name string)

Begin an output group. Output until the next `groupEnd` will be foldable in this group.

func Warning

func Warning(mes string, option *LogOption)

Adds an warning issue.

You can optionally provide a filename (file), line number (line), and column (col) number as LogOption where the warning occurred.

Types

type Command

type Command struct {
	Command    string
	Properties CommandProperties
	Message    string
}

func (Command) String

func (c Command) String() string

String returns command in logging command format.

It's port of https://github.com/actions/toolkit/blob/bfd29dcef82f324e9fb8855b6083fc0c2902bc27/packages/core/src/core.ts

type CommandProperties

type CommandProperties map[string]string

func NewCommandProperties

func NewCommandProperties(kv ...string) CommandProperties

NewCommandProperties returns a new CommandProperties from a list of key, value string pairs.

NewCommandProperties panics if given an odd number of arguments.

func (CommandProperties) Add

func (cp CommandProperties) Add(key, value string)

Add adds new properties.

func (CommandProperties) AddCol

func (cp CommandProperties) AddCol(value int)

AddLine adds new col property.

func (CommandProperties) AddFile

func (cp CommandProperties) AddFile(value string)

AddLine adds new file property.

func (CommandProperties) AddLine

func (cp CommandProperties) AddLine(value int)

AddLine adds new line property.

type LogOption

type LogOption struct {
	File string
	Line int
	Col  int
}

LogOption is logging option to indicate where message occurred.

Jump to

Keyboard shortcuts

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