From 7cd14738e91f71fcd6363f0fe756c69b8b6f0691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Kivim=C3=A4ki?= Date: Tue, 12 Nov 2024 09:46:02 +0200 Subject: [PATCH] fix: always close the GHA output file --- cmd/action/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/action/main.go b/cmd/action/main.go index 10986e88..8a9751b6 100644 --- a/cmd/action/main.go +++ b/cmd/action/main.go @@ -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) @@ -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)