Skip to content

Commit 7cd1473

Browse files
committed
fix: always close the GHA output file
1 parent 620936f commit 7cd1473

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/action/main.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func main() {
2424

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

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

52-
output.Close()
53-
5453
// Map all non error exit codes to 0 so that Github Actions job does not fail
5554
if exitCode != cli.ExitCodeError {
5655
os.Exit(cli.ExitCodeOK)

0 commit comments

Comments
 (0)