{"meta":{"title":"Setting exit codes for actions","intro":"You can use exit codes to set the status of an action. GitHub displays statuses to indicate passing or failing actions.","product":"GitHub Actions","breadcrumbs":[{"href":"/en/actions","title":"GitHub Actions"},{"href":"/en/actions/how-tos","title":"How-tos"},{"href":"/en/actions/how-tos/create-and-publish-actions","title":"Create and publish actions"},{"href":"/en/actions/how-tos/create-and-publish-actions/set-exit-codes","title":"Set exit codes"}],"documentType":"article"},"body":"# Setting exit codes for actions\n\nYou can use exit codes to set the status of an action. GitHub displays statuses to indicate passing or failing actions.\n\n## About exit codes\n\nGitHub uses the exit code to set the action's check run status, which can be `success` or `failure`.\n\n| Exit status                       | Check run status | Description                                                                                                                                                                                           |\n| --------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `0`                               | `success`        | The action completed successfully and other tasks that depend on it can begin.                                                                                                                        |\n| Nonzero value (any integer but 0) | `failure`        | Any other exit code indicates the action failed. When an action fails, all concurrent actions are canceled and future actions are skipped. The check run and check suite both get a `failure` status. |\n\n## Setting a failure exit code in a JavaScript action\n\nIf you are creating a JavaScript action, you can use the actions toolkit [`@actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) package to log a message and set a failure exit code. For example:\n\n```javascript\ntry {\n  // something\n} catch (error) {\n  core.setFailed(error.message);\n}\n```\n\nFor more information, see [Creating a JavaScript action](/en/actions/creating-actions/creating-a-javascript-action).\n\n## Setting a failure exit code in a Docker container action\n\nIf you are creating a Docker container action, you can set a failure exit code in your `entrypoint.sh` script. For example:\n\n```shell\nif <condition> ; then\n  echo \"Game over!\"\n  exit 1\nfi\n```\n\nFor more information, see [Creating a Docker container action](/en/actions/creating-actions/creating-a-docker-container-action)."}