Reader small image

You're reading from  Automating Workflows with GitHub Actions

Product typeBook
Published inNov 2021
PublisherPackt
ISBN-139781800560406
Edition1st Edition
Tools
Right arrow
Author (1)
Priscila Heller
Priscila Heller
author image
Priscila Heller

Priscila Heller was born and raised in Brazil, where she obtained a bachelor's degree in Journalism. She moved to the United States in 2011, where she has been living ever since. After working in many different fields, she found a career opportunity in Tech, and went back to school to pursue a degree in Information System Technology. In 2016 Priscila joined GitHub as an Enterprise Support Agent. Over the years she was promoted a few times, and today she is a Senior Manager of Premium Support. Priscila believes in the power of technology, education, and communication. She considers the democratization of knowledge and information to be invaluable for the cultural, social, economic, and scientific development of society and humanity.
Read more about Priscila Heller

Right arrow

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:

  1. The action completed successfully—Exit status is 0 and the check run status is success.
  2. The action failed—Exit status is non-zero (any integer) and the check run status is failed. 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...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Automating Workflows with GitHub Actions
Published in: Nov 2021Publisher: PacktISBN-13: 9781800560406

Author (1)

author image
Priscila Heller

Priscila Heller was born and raised in Brazil, where she obtained a bachelor's degree in Journalism. She moved to the United States in 2011, where she has been living ever since. After working in many different fields, she found a career opportunity in Tech, and went back to school to pursue a degree in Information System Technology. In 2016 Priscila joined GitHub as an Enterprise Support Agent. Over the years she was promoted a few times, and today she is a Senior Manager of Premium Support. Priscila believes in the power of technology, education, and communication. She considers the democratization of knowledge and information to be invaluable for the cultural, social, economic, and scientific development of society and humanity.
Read more about Priscila Heller