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

Commit 7001dd5

Browse files
authored
Merge pull request #70 from fabpot/gihub-set-output-dep
Fix deprecated usage of ::set-output
2 parents 30bce75 + 4531548 commit 7001dd5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

main.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,21 @@ func main() {
7676
fmt.Print(string(output))
7777

7878
if os.Getenv("GITHUB_WORKSPACE") != "" {
79+
gOutFile := os.Getenv("GITHUB_OUTPUT")
80+
81+
f, err := os.OpenFile(gOutFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
82+
if err != nil {
83+
fmt.Fprintf(os.Stderr, fmt.Sprintf("unable to open github output: %s\n", err))
84+
os.Exit(127)
85+
}
86+
defer f.Close()
87+
7988
// inside a Github action, export vulns
8089
if output, err := security.Format(vulns, "raw_json"); err == nil {
81-
fmt.Printf("::set-output name=vulns::%s", output)
90+
if _, err = f.WriteString("vulns=" + string(output) + "\n"); err != nil {
91+
fmt.Fprintf(os.Stderr, fmt.Sprintf("unable to write into github output: %s\n", err))
92+
os.Exit(127)
93+
}
8294
}
8395
}
8496

0 commit comments

Comments
 (0)