Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
tjamet committed Sep 14, 2023
1 parent 9d8fbc7 commit 40dad5c
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,7 @@ func formatOutput(name, value string) string {

// ExportVariable sets the environment varaible name (for this action and future actions)
func ExportVariable(name, value string) {
if path, ok := os.LookupEnv(GitHubExportEnvFilePathEnvName); ok {
f, err := open(path, os.O_RDWR|os.O_APPEND, 0)
if err != nil {
Warningf("failed to open environment export file %s: %v", path, err)
} else {
defer f.Close()
f.Write([]byte(formatOutput(name, value)))
}
} else {
Warningf("did not find environment export file from environment variable %s, falling back to the deprecated command implementation", GitHubExportEnvFilePathEnvName)
}
if err := issueFileCommand("ENV", fmt.Sprintf("%s<<%s%s%s%s%s", name, delimiter, EOF, value, delimiter, EOF)); err != nil {
if err := issueFileCommand("ENV", formatOutput(name, value)); err != nil {
IssueCommand("set-env", map[string]string{"name": name}, value)
}
os.Setenv(name, value)
Expand Down Expand Up @@ -107,15 +96,7 @@ func GetInputOrDefault(name, dflt string) string {

// SetOutput sets the value of an output for future actions
func SetOutput(name, value string) {
if path, ok := os.LookupEnv(GitHubOutputFilePathEnvName); ok {
f, err := open(path, os.O_RDWR|os.O_APPEND, 0)
if err != nil {
Warningf("failed to open output file %s: %v", path, err)
} else {
defer f.Close()
f.Write([]byte(formatOutput(name, value)))
}
} else {
if err := issueFileCommand("OUTPUT", formatOutput(name, value)); err != nil {
Warningf("did not find output file from environment variable %s, falling back to the deprecated command implementation", GitHubOutputFilePathEnvName)
}
IssueCommand("set-output", map[string]string{"name": name}, value)
Expand Down Expand Up @@ -195,15 +176,7 @@ func Group(name string, f func()) func() {

// SaveState saves state for current action, the state can only be retrieved by this action's post job execution.
func SaveState(name, value string) {
if path, ok := os.LookupEnv(GitHubStateFilePathEnvName); ok {
f, err := open(path, os.O_RDWR|os.O_APPEND, 0)
if err != nil {
Warningf("failed to open state file %s: %v", path, err)
} else {
defer f.Close()
f.Write([]byte(formatOutput(name, value)))
}
} else {
if err := issueFileCommand("STATE", formatOutput(name, value)); err != nil {
Warningf("did not find state file from environment variable %s, falling back to the deprecated command implementation", GitHubStateFilePathEnvName)
}
IssueCommand("save-state", map[string]string{"name": name}, value)
Expand Down

0 comments on commit 40dad5c

Please sign in to comment.