Skip to content

Commit

Permalink
Deprecated set-output (#51)
Browse files Browse the repository at this point in the history
* Update setting of modifiedFiles to be performed via an append to

* Fix var declaration

* Update main.go

Co-authored-by: Jackson Hamburger <jackson@Jacksons-MacBook-Pro.local>
  • Loading branch information
SamuelChorvat and Jackson Hamburger committed Jan 11, 2023
1 parent 657b0d1 commit f5f4ad7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ func findAndReplace(path string, find string, replace string, regex bool) (bool,
return false, nil
}

func setGithubEnvOutput(key string, value int) {
outputFilename := os.Getenv("GITHUB_OUTPUT")
f, err := os.OpenFile(outputFilename,
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Println(err)
}
defer f.Close()
if _, err := f.WriteString(fmt.Sprintf("%s=%d\n", key, value)); err != nil {
log.Println(err)
}
}

func main() {
include, _ := getenvStr("INPUT_INCLUDE")
exclude, _ := getenvStr("INPUT_EXCLUDE")
Expand Down Expand Up @@ -130,5 +143,5 @@ func main() {
}
}

fmt.Println(fmt.Sprintf(`::set-output name=modifiedFiles::%d`, modifiedCount))
setGithubEnvOutput("modifiedFiles", modifiedCount)
}

0 comments on commit f5f4ad7

Please sign in to comment.