Skip to content

Commit

Permalink
Remove deprecated way of setting outputs of GitHub Action. fixes #76
Browse files Browse the repository at this point in the history
  • Loading branch information
ribtoks committed Aug 28, 2024
1 parent 4439e07 commit 41c9045
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,27 @@ func (s *service) closeMissingIssues(issueMap map[string]*github.Issue, comments
log.Printf("Closed issues. count=%v", count)
}

func appendGitHubActionOutput() {
githubOutput := os.Getenv("GITHUB_OUTPUT")
if githubOutput == "" {
fmt.Println("GITHUB_OUTPUT environment variable is not set")
return
}

f, err := os.OpenFile(githubOutput, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
fmt.Fprintf(os.Stderr, "Error opening file: %v\n", err)
return
}
defer f.Close()

_, err = fmt.Fprintln(f, "scannedIssues=1")
if err != nil {
fmt.Fprintf(os.Stderr, "Error writing to file: %v\n", err)
return
}
}

func main() {
log.SetOutput(os.Stdout)

Expand Down Expand Up @@ -584,5 +605,5 @@ func main() {
svc.assignNewIssues()
}

fmt.Println(`::set-output name=scannedIssues::1`)
appendGitHubActionOutput()
}

0 comments on commit 41c9045

Please sign in to comment.