Author and maintain actions
Drill 20 practice questions focused entirely on Author and maintain actions for the GitHub GH-200 exam. Tap an answer for instant feedback and a full explanation — no sign-up, always free.
You maintain a public JavaScript action and want to publish it to the GitHub Marketplace with a recognizable icon and color on its listing card. You are editing action.yml to add this presentation. Which top-level metadata key must you configure to control the Marketplace listing's icon and color?
Your team maintains an internal action that formats and validates JSON configuration files. It must run identically on GitHub-hosted ubuntu, windows, and macos runners, must start with minimal overhead (no container pull), and its logic is complex enough that the team wants to write and unit-test it in TypeScript rather than orchestrating existing shell commands. Which action type best fits these requirements?
You maintain a composite action that runs a linter and then, only when the linter step fails, uploads a diagnostic report. In the action.yml you add a step with `uses: actions/upload-artifact@v4` and want it to execute regardless of prior step outcome but only when the linting step specifically failed. The linting step has `id: lint`. Which configuration on the upload step correctly achieves this within a composite action?
You are packaging a reusable set of shell steps as a composite action inside a repository at the path .github/actions/deploy-helper/. A teammate consuming the action with uses: ./.github/actions/deploy-helper reports the error 'Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under ...deploy-helper'. You confirm the folder contains a file named composite-action.yml with valid metadata and runs.using set to 'composite'. What is the correct fix?
You are authoring a composite action that formats code. The action.yml declares an input named `target-path` with a default of `.`. Inside a `run` step in the composite action, you need to reference the caller-supplied value of this input to pass it to a CLI command. Which syntax correctly references the input inside the composite action's run step?
You are creating a composite action that bundles several shell steps and one reference to another action. A teammate's first draft of action.yml fails to load with the error 'Missing required property: using'. Which value must the 'runs.using' key be set to for this composite action to be valid?
You are authoring a composite action for your organization. The action.yml defines a `runs.using: composite` block with several `run:` steps that execute build commands. When a teammate consumes the action in a workflow, the run fails immediately with the error: "Error: Required property is missing: shell". What must you change in the action.yml to resolve this?
You are authoring a composite action that installs a custom CLI tool into a temporary directory and needs subsequent steps in the calling workflow's job to be able to invoke the tool by name without specifying its full path. The install step downloads the binary to $HOME/.mytool/bin. Which approach inside the composite action's action.yml correctly makes the binary available to later steps?
You are authoring a composite action that runs a shell script to compute a build hash, and you need to expose that hash as an output of the action so calling workflows can reference it via steps.<id>.outputs.build-hash. In the run step you have the value in a shell variable $HASH. Which combination correctly wires this up in the action's metadata and script?
You maintain a Docker container action that builds from a `Dockerfile` in the repository root. It works on your local machine and on self-hosted ARM64 runners, but every run on the standard GitHub-hosted `ubuntu-latest` runner fails immediately during the container build step with an 'exec format error' when the entrypoint script is invoked. The action.yml declares `runs.using: docker` and `runs.image: Dockerfile`. What is the most likely cause and appropriate fix?
You are authoring a Docker container action stored at the root of a repository. Your action.yml declares 'runs.using: docker' and needs to build the image from a Dockerfile located in the same directory as action.yml. You want GitHub to build the image at runtime from your source rather than pulling a pre-built image from a registry. Which 'image' value in action.yml achieves this?
Your team maintains a Docker container action used across several repositories. To speed up job startup, you want the action to pull a pre-built image from GitHub Container Registry (ghcr.io) instead of building the Dockerfile on every run. Which value should you set for the `runs.image` key in the action's action.yml?
You are authoring a Docker container action. Inside the entrypoint script (a bash script that runs as the container's ENTRYPOINT), you need to expose a value called build-id so that subsequent steps in the consuming workflow can reference it via steps.<id>.outputs.build-id. Which mechanism inside the container script correctly sets this step output?
Your team maintains a popular JavaScript action distributed via the GitHub Marketplace. After GitHub's immutable-actions feature is enabled for your repository and you publish a new release, a downstream consumer reports that their workflow now resolves your action from the GitHub Container Registry (ghcr.io) rather than fetching the Git ref from the repository. The consumer asks what practical change immutable actions introduce for how they should reference your action. Which statement best describes the correct implication for the consumer?
You author a JavaScript action whose action.yml declares `runs.using: node20` and `runs.main: index.js`. The source imports `@actions/core` and `@actions/github`. When another repository references your action with `uses: your-org/greet-action@v1`, the workflow fails immediately with an error indicating that the module '@actions/core' cannot be found. Your repository contains only `action.yml`, `index.js`, and `package.json` on the tagged commit. What is the most appropriate fix?
You are authoring a JavaScript action that starts a background proxy process during the main step and must ensure the proxy is always terminated after the job finishes, even if a later step in the workflow fails. You want this cleanup logic to run automatically without requiring consumers to add a separate step. Which action.yml configuration achieves this?
You are authoring a JavaScript action that will run directly on the runner's Node.js environment. Your repository contains an action.yml file and a compiled dist/index.js entry point committed to source control. Which runs configuration in action.yml correctly declares this as a JavaScript action targeting a supported Node runtime?
You are authoring a JavaScript action stored at the root of a repository. The compiled entrypoint is bundled into dist/index.js using a tool like ncc. When a consumer references your action, the runner reports: 'Error: File not found: index.js'. Your action.yml currently contains a 'runs' block with 'using: node20'. Which change to action.yml will correctly point the runner at your bundled entrypoint?
You are authoring a JavaScript action. Your team recently migrated the codebase to target the latest supported Node.js runtime on GitHub-hosted runners. In action.yml, the current metadata block reads: runs: using: 'node16' main: 'dist/index.js' Runners have begun emitting deprecation warnings, and you want the action to execute on the current default Node runtime. Which single change to the metadata correctly updates the action?
You maintain a JavaScript action that validates a configuration file passed as an input. When validation fails, the action currently logs an error with console.error() and continues, but the workflow step still reports success and downstream steps run against invalid config. You need the step to be marked as failed and halt the job (assuming default continue-on-error). Using the @actions/core toolkit, what is the correct way to signal failure from the action code?
More GH-200 practice
Keep going with the other GitHub Actions (GH-200) domains, or take a full timed mock exam.
← Back to GH-200 overview