Skip to content

Commit

Permalink
Add SetFailedf and IsDebug helpers
Browse files Browse the repository at this point in the history
SetFailedf prevents from having to use Sprintf in caller methods
  • Loading branch information
tjamet committed Nov 2, 2020
1 parent dd77f91 commit e31e1f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/core.go
Expand Up @@ -63,6 +63,11 @@ func SetOutput(name, value string) {
IssueCommand("set-output", map[string]string{"name": name}, value)
}

// SetFailedf sets the action status to failed and sets an error message
func SetFailedf(format string, args ...interface{}) {
SetFailed(fmt.Sprintf(format, args...))
}

// SetFailed sets the action status to failed and sets an error message
func SetFailed(message string) {
statusAccess.Lock()
Expand Down Expand Up @@ -139,3 +144,8 @@ func SaveState(name, value string) {
func GetState(name string) string {
return os.Getenv("STATE_" + name)
}

// IsDebug returns whether the github actions is currently under debug
func IsDebug() bool {
return os.Getenv("RUNNER_DEBUG") == "1"
}

0 comments on commit e31e1f9

Please sign in to comment.