1
0
mirror of synced 2026-01-04 00:06:20 -05:00
Files
docs/content/actions/creating-actions/setting-exit-codes-for-actions.md
Nick Schonning d9167f1449 chore: Add missing code fence languages (#772)
* chore: Add missing code fence languages

* Update content/actions/creating-actions/dockerfile-support-for-github-actions.md

* Add raw & endraw markers around shell content

See review comment by @rachmari

* Add raw & endraw markers around shell content

See review comment by @rachmari

* Remove language from code fences

to avoid the problem of replaceable text indicates like
<this> not showing up in the output page.

Co-authored-by: hubwriter <hubwriter@github.com>
2021-01-18 12:04:46 +00:00

1.9 KiB

title, shortTitle, intro, product, redirect_from, versions, type
title shortTitle intro product redirect_from versions type
Setting exit codes for actions Setting exit codes You can use exit codes to set the status of an action. {% data variables.product.prodname_dotcom %} displays statuses to indicate passing or failing actions. {% data reusables.gated-features.actions %}
/actions/building-actions/setting-exit-codes-for-actions
free-pro-team enterprise-server
* >=2.22
how_to

{% data reusables.actions.enterprise-beta %} {% data reusables.actions.enterprise-github-hosted-runners %}

About exit codes

{% data variables.product.prodname_dotcom %} uses the exit code to set the action's check run status, which can be success or failure.

Exit status Check run status Description
0 success The action completed successfully and other tasks that depends on it can begin.
Nonzero value 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.

Setting a failure exit code in a JavaScript action

If you are creating a JavaScript action, you can use the actions toolkit @actions/core package to log a message and set a failure exit code. For example:

try {
  // something
} catch (error) {
  core.setFailed(error.message);
}

For more information, see "Creating a JavaScript action."

Setting a failure exit code in a Docker container action

If you are creating a Docker container action, you can set a failure exit code in your entrypoint.sh script. For example:

{% raw %}

if <condition> ; then
  echo "Game over!"
  exit 1
fi

{% endraw %}

For more information, see "Creating a Docker container action."