Using exit codes
Adding exit codes to your action can help you monitor the action's check run status.
GitHub displays statuses to illustrate whether an action run succeeded or failed. Those statuses are binary and simply represent whether an action run succeeded or failed, and are outlined further here:
- The action completed successfully—Exit status is
0
and the check run status issuccess
. - The action failed—Exit status is
non-zero
(any integer) and the check run status isfailed
. All concurrent actions are cancelled, and future actions are skipped.
Adding exit codes to a JavaScript action
Use the @actions/core
actions toolkit package to set failure exit codes and log a message, as follows:
try { // add thing to be tried here } catch (error) { core.setFailed(error.message); }
Adding exit codes to a Docker container action
Use your entrypoint.sh
file to add a failure exit code, as follows:
if <this happens...