From 7116bc2d750f2c435970f7e806c112534a964f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Kivim=C3=A4ki?= Date: Thu, 9 Nov 2023 14:12:16 +0200 Subject: [PATCH] Make Action only exit with 0 and 1 codes --- cmd/action/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/action/main.go b/cmd/action/main.go index eea79b57..41bc9e14 100644 --- a/cmd/action/main.go +++ b/cmd/action/main.go @@ -40,12 +40,18 @@ func main() { } } fmt.Fprintf(output, "exit-code=%d\n", exitCode) - os.Exit(exitCode) + + // Map all non error exit codes to 0 so that Github Actions job does not fail + if exitCode != cli.ExitCodeError { + os.Exit(cli.ExitCodeOK) + } else { + os.Exit(cli.ExitCodeError) + } } func checkErr(err error) { if err != nil { fmt.Printf("%+v\n", err) - os.Exit(1) + os.Exit(cli.ExitCodeError) } }