Skip to content

Commit

Permalink
fix: always close the GHA output file
Browse files Browse the repository at this point in the history
  • Loading branch information
majori committed Nov 12, 2024
1 parent 620936f commit 7cd1473
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cmd/action/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func main() {

output, err := os.OpenFile(os.Getenv("GITHUB_OUTPUT"), os.O_APPEND|os.O_WRONLY, 0644)
checkErr(err)
defer output.Close()

// Write contents to the output file and to stdout
out := io.MultiWriter(os.Stdout, output)
Expand All @@ -49,8 +50,6 @@ func main() {
err = output.Sync()
checkErr(err)

output.Close()

// Map all non error exit codes to 0 so that Github Actions job does not fail
if exitCode != cli.ExitCodeError {
os.Exit(cli.ExitCodeOK)
Expand Down

0 comments on commit 7cd1473

Please sign in to comment.