GH-200 domain - 18% of the exam

Author and maintain actions

Author and maintain actions is 18% of the GH-200 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

49
Practice questions
6
Objectives
40
Medium
9
Hard

Where people go wrong

  • Choosing an action type for the wrong platform constraint

    The wrong answers pick Docker for portability, composite for identical cross-platform behaviour, or JavaScript for packaging system tools. A Docker container action runs only on Linux runners, but its image bundles a specialised tool and its system dependencies. A JavaScript action runs on the runner's Node.js, so it works on Ubuntu, Windows, and macOS without an image, yet it cannot ship system binaries. A composite action installs tools at runtime and depends on each platform's shell.

    See it in a sample question
  • Expecting an action's value to reach the caller without an output

    The wrong answers expect a value to reach the calling workflow through the wrong channel. core.exportVariable writes to GITHUB_ENV and sets an environment variable, core.saveState passes data only to the action's own post step, and core.setSecret only masks a string in logs. core.setOutput writes to GITHUB_OUTPUT and registers an output. A composite action must also declare an outputs block mapped to steps.gen.outputs.token, because a caller cannot read the action's internal step ids.

    See it in a sample question
  • Expecting a message or annotation to fail the step

    The wrong answers treat a visible message as a failed step. core.warning, a Markdown entry in GITHUB_STEP_SUMMARY, and an ::error:: annotation all show on the run without changing the exit code, so the step still passes and dependent jobs proceed. continue-on-error does the opposite, reporting a failing step as successful. A JavaScript action fails through core.setFailed, which sets a non-zero exit code, and a Docker container action fails when its entrypoint exits with a non-zero status.

    See it in a sample question
  • Misreading what a uses reference resolves to

    The wrong answers expect a major or partial reference to follow a minor tag, a release branch, the latest release flag, or the highest matching version. A uses reference resolves only to the Git ref of that exact name. A first release gets both an exact tag, such as v1.0.0, and a major tag such as v1, and the major tag is repointed to each later compatible release. A major.minor reference such as v2.3 receives only patches in that line, and only if the vendor repoints a moving 2.3 tag.

    See it in a sample question
  • Looking for a Marketplace listing in the wrong place

    The wrong answers look for a Marketplace listing through GitHub Pages, a marketplace-labelled pull request, a metadata key or a docker subdirectory, or use the Marketplace to share code that must stay private. A listing is created by drafting a release and choosing to publish the action to the Marketplace, and it needs a public repository with a single action.yml or action.yaml at the root. Private sharing inside an organisation uses a private repository with Actions access granted to the organisation's other repositories.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleAuthor and maintain actionsmedium

A maintainer is weighing whether a Docker container action fits a workflow that runs on GitHub-hosted Ubuntu, Windows, and macOS runners. Which two statements about Docker container actions are accurate constraints the maintainer should account for? Select TWO.

runs:
  using: "docker"
  image: "Dockerfile"
  • AThe action is restricted to Linux runners, so it cannot run on the Windows and macOS GitHub-hosted runners that the same workflow also uses. Correct
  • BThe action runs natively on every hosted operating system because the runner translates the image to match Windows and macOS at execution time.
  • CThe image can bundle a specialised tool and its system dependencies, giving a self-contained environment without installing the tool at runtime. Correct
  • DThe action reads each declared input from the steps context only, so inputs never reach the entrypoint as environment variables inside the container.
Account for a Docker container action being Linux-only while letting an image bundle a tool and its system dependencies self-contained. A Docker container action is declared with using: docker and an image, and it executes only on Linux runners, so it cannot serve the Windows and macOS legs of a multi-platform workflow. Its advantage is that the image bakes in a specialised tool and all system dependencies, giving a self-contained environment, and the runner passes declared inputs into the container as INPUT_ environment variables rather than withholding them.

Why A is correct: Docker container actions execute only on Linux runners, so a workflow that also targets Windows and macOS hosted runners cannot use the same container action on those hosts.

Why B is wrong: Tempting because containers seem portable, but the runner does not translate Linux images for Windows or macOS, so the Linux-only restriction still applies in practice.

Why C is correct: Baking the tool and its OS-level dependencies into the image is the main strength of a Docker container action, giving a self-contained environment that avoids runtime installation.

Why D is wrong: Tempting since outputs use the steps context, but inputs reach a container action as INPUT_ environment variables, so the entrypoint can read them rather than being denied access.

Free sampleAuthor and maintain actionsmedium

A composite action runs a script step that writes a value to GITHUB_OUTPUT, and a workflow job calls the action and references its output, but the downstream expression always resolves to an empty string. The action's action.yml currently declares no outputs block. What change makes the value available to the calling workflow?

# action.yml (composite)
runs:
  using: composite
  steps:
    - id: gen
      shell: bash
      run: echo "token=abc" >> "$GITHUB_OUTPUT"
  • AChange the step to write the value to GITHUB_ENV instead of GITHUB_OUTPUT, because composite actions can only expose values to callers through exported environment variables.
  • BReference the value in the caller as steps.gen.outputs.token, because a calling workflow reads a composite action's internal step outputs directly through the steps context.
  • CPin the composite action to a full commit SHA in the caller's uses field, because outputs are only forwarded when the referenced version is resolved to an immutable commit.
  • DAdd an outputs block to action.yml that declares token and maps it to steps.gen.outputs.token, because a composite action only exposes outputs it explicitly declares. Correct
Expose a composite action value by declaring it in the action's outputs block and mapping it to the producing step's output. A composite action does not automatically surface its internal step outputs to the caller. The calling workflow can only read outputs the action declares in its action.yml outputs block, where each output value is mapped to an expression such as steps.gen.outputs.token. Writing to GITHUB_ENV sets environment variables rather than outputs, the caller cannot reach the action's internal step ids, and the uses reference style does not affect output forwarding.

Why A is wrong: Tempting because GITHUB_ENV does pass values between steps, but it sets environment variables for later steps, not action outputs, so the caller still cannot read the value as an action output.

Why B is wrong: Tempting because steps.gen.outputs.token is how the value is read inside the action, but the caller's steps context does not see another action's internal step ids, so this resolves to nothing.

Why C is wrong: Tempting because pinning to a commit SHA is recommended for security, but the reference style has no effect on whether outputs are forwarded, so the empty value would persist.

Why D is correct: A composite action must declare an outputs block and map each output to the producing step's value, so adding token mapped to steps.gen.outputs.token forwards the value to the calling workflow.

Free sampleAuthor and maintain actionsmedium

A JavaScript action validates its inputs and, on a validation problem, currently logs a message and lets the function return normally. The maintainer notices the workflow step is marked as successful even when validation has clearly gone wrong, so later jobs proceed on bad data. Which approach makes the step fail and surface the error in the run log as intended?

const core = require('@actions/core');
if (!valid) {
  core.info('input was rejected');
  return;
}
  • ACall core.setFailed with a descriptive message on the validation problem, because that sets a failing exit code and records the message as an error in the run log. Correct
  • BReplace core.info with core.warning on the validation problem, because a warning annotation is treated as a non-passing result that stops the step from being marked successful.
  • CWrite the message to GITHUB_STEP_SUMMARY on the validation problem, because content appended there is interpreted by the runner as a failure signal for the step.
  • DSet continue-on-error to true in the calling workflow step, because that flag converts a silent return into a recorded failure that blocks the dependent jobs.
Use core.setFailed to set a failing exit code and log an error so a JavaScript action's step is correctly marked as failed. A JavaScript action that returns normally produces a zero exit code, so the step passes even after a logged problem. core.setFailed both writes the message as an error annotation and sets a non-zero exit code, which the runner interprets as a failed step that can stop dependent jobs. core.warning and the step summary do not change the exit code, and continue-on-error would suppress failures rather than create one.

Why A is correct: core.setFailed records the message as an error and sets a non-zero process exit code, so the step is correctly marked as failed and the reason is visible in the run log.

Why B is wrong: Tempting because core.warning adds a visible annotation, but a warning does not change the exit code, so the step still completes successfully and later jobs continue on bad data.

Why C is wrong: Tempting because the step summary is a real reporting surface, but writing to GITHUB_STEP_SUMMARY only adds markdown to the run summary and never affects whether the step passes or fails.

Why D is wrong: Tempting because continue-on-error relates to step failure handling, but it makes a failing step be treated as successful, the opposite of recording a failure, and a clean return is not a failure anyway.

Free sampleAuthor and maintain actionshard

A consuming team currently references a third-party action as uses: vendor/build-tool@v2 and a teammate proposes changing the reference to uses: vendor/build-tool@v2.3 instead, expecting it to behave the same. The vendor follows GitHub's recommended tag scheme and publishes exact patch tags plus a moving major tag. Compared with the bare major reference, what does pinning to the major.minor reference actually give the team?

  • AIt receives only patch-level updates within the 2.3 line and not later minor features, but only if the vendor also maintains a moving 2.3 tag and repoints it to each new patch in that minor series. Correct
  • BIt pins the workflow to an immutable commit, because a major.minor tag is frozen on publication and the vendor can never repoint it, giving the same reproducibility as pinning to a full commit SHA would.
  • CIt always resolves to the newest 2.x release the same as the bare major reference, because GitHub expands any partial version tag to the highest matching version it can find at run time.
  • DIt receives every backward-compatible 2.x update including new minor features, exactly matching the bare major reference, because both forms are interpreted by GitHub as a request for the latest compatible release.
Recognise that a major.minor action reference tracks patches within that minor only when the maintainer publishes and moves that minor tag. A uses reference resolves the literal Git ref it names rather than expanding to the highest matching version. Pinning to v2.3 therefore narrows the update window to the 2.3 minor line, receiving its patches but not the features added in 2.4, and it only behaves that way if the maintainer chooses to publish a moving 2.3 tag and repoint it to each 2.3 patch. It is not immutable like a SHA, it does not resolve to the newest 2.x like the bare major, and it is not equivalent to the major reference because it excludes later minors.

Why A is correct: A major.minor reference resolves to a 2.3 Git ref, so it tracks patches within 2.3 and excludes 2.4 features, but only when the vendor actually publishes and repoints that minor tag.

Why B is wrong: Tempting because the longer reference looks more specific, but a major.minor tag is still an ordinary movable Git tag, so it does not provide the immutability that only a full commit SHA gives.

Why C is wrong: Tempting since both start with 2, but GitHub does not expand partial tags to the highest match; a uses reference resolves the literal Git ref named v2.3, not the newest 2.x.

Why D is wrong: Tempting because both track compatible updates, but the bare major follows the whole 2.x line whereas the major.minor stays within 2.3, so the two references are not equivalent.

Free sampleAuthor and maintain actionsmedium

An organisation has authored a deployment action and must keep its source code off the public internet while still letting every repository in the same organisation reference it with uses:. They want the lowest-overhead internal distribution rather than copying the code into each repository. Which two steps make this private internal distribution work? Select TWO.

  • AHost the action in a private repository owned by the organisation, because a private repository keeps the source code off the public internet while still allowing other repositories to reference it through a uses: statement. Correct
  • BEnable Actions access to the private repository for the organisation's other repositories, because access must be granted explicitly before another repository's workflow may resolve the action through uses:. Correct
  • CPublish the action to the GitHub Marketplace as an unlisted entry, because an unlisted Marketplace publication shares the action internally while hiding it from the public Marketplace catalogue search.
  • DAdd each consuming repository as an outside collaborator on the action repository, because collaborator membership is what lets a workflow in another repository resolve the action through a uses: reference.
Distribute an internal action by hosting it in a private organisation repository and granting Actions access to the organisation's other repositories. Keeping a custom action private and shareable inside an organisation means hosting it in a private organisation-owned repository and then granting that repository's Actions access to the organisation's other repositories, after which their workflows resolve it with uses:. A Marketplace listing requires a public repository and exposes the source, and cross-repository Actions access is a repository setting rather than outside-collaborator membership, so those two steps are the supported path.

Why A is correct: A private organisation-owned repository keeps the action source off the public internet while remaining referenceable with uses: by approved repositories, which satisfies the privacy requirement.

Why B is correct: GitHub blocks one private repository's action from being used elsewhere until Actions access is granted, so enabling that access is required for the uses: reference to resolve.

Why C is wrong: Tempting because hiding a listing sounds private, but Marketplace publication needs a public repository and exposes the source, so it cannot keep the code off the public internet.

Why D is wrong: Tempting since collaboration grants access, but Actions access between repositories is a repository setting, not collaborator membership, so adding collaborators does not enable the uses: reference.

Other domains in this exam

See also the GH-200 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by GitHub. Original, blueprint-aligned practice material only.