nerdexam
Microsoft

GH-200 · Question #21

What can be used to set a failed status of an action from its code?

The correct answer is D. a non-zero exit code. A non-zero exit code is the universal mechanism for signaling failure from an action's code. When any step or script exits with a code other than 0, GitHub Actions marks that step-and typically the overall job-as failed. This works across Docker container actions (via CMD or…

Author and Maintain Actions

Question

What can be used to set a failed status of an action from its code?

Options

  • AJavaScript dist/ folder
  • Bcomposite run step
  • Coutput variable
  • Da non-zero exit code
  • EDockerfile CMD
  • F@actions/github toolkit

How the community answered

(27 responses)
  • B
    4% (1)
  • C
    4% (1)
  • D
    93% (25)

Explanation

A non-zero exit code is the universal mechanism for signaling failure from an action's code. When any step or script exits with a code other than 0, GitHub Actions marks that step-and typically the overall job-as failed. This works across Docker container actions (via CMD or ENTRYPOINT), JavaScript actions (via process.exit(1)), and shell scripts. While the @actions/core toolkit provides setFailed(), it ultimately sets a non-zero exit code under the hood.

Topics

#Exit codes#Action failure#Step status

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice