Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #70 from fabpot/gihub-set-output-dep
Browse files Browse the repository at this point in the history
Fix deprecated usage of ::set-output
  • Loading branch information
fabpot authored Dec 7, 2022
2 parents 30bce75 + 4531548 commit 7001dd5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,21 @@ func main() {
fmt.Print(string(output))

if os.Getenv("GITHUB_WORKSPACE") != "" {
gOutFile := os.Getenv("GITHUB_OUTPUT")

f, err := os.OpenFile(gOutFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
fmt.Fprintf(os.Stderr, fmt.Sprintf("unable to open github output: %s\n", err))
os.Exit(127)
}
defer f.Close()

// inside a Github action, export vulns
if output, err := security.Format(vulns, "raw_json"); err == nil {
fmt.Printf("::set-output name=vulns::%s", output)
if _, err = f.WriteString("vulns=" + string(output) + "\n"); err != nil {
fmt.Fprintf(os.Stderr, fmt.Sprintf("unable to write into github output: %s\n", err))
os.Exit(127)
}
}
}

Expand Down

0 comments on commit 7001dd5

Please sign in to comment.