nerdexam
Microsoft

GH-200 · Question #38

In GitHub Actions, how is the success or failure of a step determined by its exit code?

The correct answer is B. Zero exit code means success and any nonzero means failure. GitHub Actions follows the standard Unix/POSIX convention for process exit codes. (B) is correct: an exit code of 0 indicates the step succeeded, and any nonzero exit code (1, 2, 127, etc.) indicates failure. When a step fails, the job stops and subsequent steps are skipped unles

Author and Maintain Workflows

Question

In GitHub Actions, how is the success or failure of a step determined by its exit code?

Options

  • AExit codes are ignored and a maintainer sets the result manually
  • BZero exit code means success and any nonzero means failure
  • CSuccess is controlled by continue-on-error rather than the exit code
  • DEvery exit code is a failure

How the community answered

(28 responses)
  • A
    4% (1)
  • B
    93% (26)
  • C
    4% (1)

Explanation

GitHub Actions follows the standard Unix/POSIX convention for process exit codes. (B) is correct: an exit code of 0 indicates the step succeeded, and any nonzero exit code (1, 2, 127, etc.) indicates failure. When a step fails, the job stops and subsequent steps are skipped unless configured otherwise with 'continue-on-error: true'. (A) is wrong - GitHub Actions does not require manual intervention to set step results. (C) is wrong - 'continue-on-error' controls whether a job continues after a failed step, but success/failure is still determined by the exit code. (D) is wrong - exit code 0 is explicitly a success indicator.

Topics

#GitHub Actions#Step execution#Exit codes#Workflow control flow

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice