GitHub Actions (GH-200) · 18% practice allocation

GitHub GH-200: Author and Maintain Actions Practice Questions

5 free sample questions from the Author and Maintain Actions domain, with answers and explanations. The full GH-200 bank has 133 questions across 5 domains. Questions are scenario-based and written from the official GitHub exam guide.

1.

Your team wants to test a GitHub Action locally before pushing to GitHub. Which tool is specifically designed to run GitHub Actions workflows on a local machine by emulating the GitHub Actions runner environment?

  • A. docker-compose
  • B. act✓ Correct
  • C. github-runner-local
  • D. nektos/local-runner
Explanation

'act' (github.com/nektos/act) is the purpose-built open-source tool for running GitHub Actions workflows locally. It uses Docker to emulate the runner environment, reads your workflow YAML, and executes jobs on your machine. 'nektos/local-runner' is a misconception — 'act' is the actual project under the nektos organization, but it is named 'act', not 'local-runner'. 'github-runner-local' does not exist as a tool. docker-compose orchestrates multi-container Docker applications and has no awareness of GitHub Actions workflow syntax.

2.

You develop a JavaScript action and need to read an input value inside your index.js. The input is named 'target-branch'. Which code snippet correctly retrieves it?

  • A. const branch = core.getSecret('target-branch');
  • B. const branch = core.getInput('target-branch');✓ Correct
  • C. const branch = process.env.TARGET_BRANCH;
  • D. const branch = github.context.inputs['target-branch'];
Explanation

core.getInput('target-branch') is the correct and idiomatic way to retrieve a named input in a JavaScript action using the @actions/core toolkit. It reads the INPUT_TARGET-BRANCH environment variable under the hood and trims whitespace. process.env.TARGET_BRANCH would look for a plain environment variable named TARGET_BRANCH, not the INPUT_ prefixed one the runner sets; the exact var name would be INPUT_TARGET-BRANCH, making this unreliable without careful casing. github.context does not expose action inputs — it provides event/repository context. core.getSecret() is not a real @actions/core API method.

3.

A developer writes a JavaScript action and wants to set an output value named 'result' that downstream steps can consume. Which code snippet from the @actions/core package correctly sets this output?

  • A. core.setOutput('result', value);✓ Correct
  • B. core.info('result=' + value);
  • C. core.exportVariable('result', value);
  • D. core.setSecret('result', value);
Explanation

core.setOutput('result', value) is the correct API to publish a named output from an action so that subsequent steps can reference it via ${{ steps.<id>.outputs.result }}. core.exportVariable() sets an environment variable that is available to later steps, not an output. core.setSecret() masks a value in logs but does not create an output. core.info() merely prints to the log and does not create any accessible output value.

4.

A developer writes a composite action. During testing, they notice that when an inner step fails, the composite action continues executing subsequent steps instead of stopping. They want the composite action to stop immediately on the first step failure. Which approach correctly achieves this within a composite action?

  • A. Add if: success() to each subsequent step so they only run when all prior steps have succeeded.✓ Correct
  • B. Add shell: bash with set -e only to the first step; bash will propagate the error to all subsequent steps automatically.
  • C. Composite actions automatically stop on first failure like regular jobs; the developer must have a bug in their step's exit code.
  • D. Set continue-on-error: false at the composite action level in action.yml to enforce strict failure propagation.
Explanation

Within a composite action's steps, steps do not automatically halt on failure the same way a job might — especially if a prior step uses continue-on-error. Adding if: success() to each subsequent step ensures they are skipped when any prior step has failed. Composite action steps do not universally stop on first failure by default, particularly when steps use different shells or continue-on-error is involved — so claiming it is automatic is incorrect. There is no composite-action-level continue-on-error flag in action.yml. set -e in bash applies only within that specific run step's shell process and does not affect other steps in the composite action.

5.

Which TWO of the following are valid 'using' values in the 'runs' section of an action.yml for defining how the action executes? (Select TWO)

  • A. node20✓ Correct
  • B. runner
  • C. python3
  • D. composite✓ Correct
  • E. bash
Explanation

The valid 'using' values for the 'runs' key are JavaScript runtime versions (e.g., node20, node16), 'docker', and 'composite'. 'node20' specifies that the action runs as a JavaScript action on the Node.js 20 runtime. 'composite' specifies a composite action made up of multiple steps. 'python3' is not a supported runtime for GitHub Actions' 'using' field — Python scripts must be invoked via a Docker or composite action. 'bash' is not a valid 'using' value; shell commands are used inside composite action steps, not as a top-level runtime. 'runner' is not a valid value.

Test yourself across every GH-200 domain

The free GH-200 practice test mixes about 20 questions weighted like the exam. The full 133-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

Author and Maintain Actions study guide (GH-200) →

Other GH-200 domains

← All GitHub Actions study resources