Skip to content

Commit

Permalink
Make Action only exit with 0 and 1 codes
Browse files Browse the repository at this point in the history
  • Loading branch information
majori committed Nov 9, 2023
1 parent f8bc371 commit 7116bc2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/action/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 7116bc2

Please sign in to comment.