GH-200 domain - 25% of the exam

Author and manage workflows

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

The domain in numbers

67
Practice questions
8
Objectives
51
Medium
16
Hard

Where people go wrong

  • Confusing the trigger events

    The wrong answers hand the job to the nearest-sounding event. push is offered for a nightly time-based run and for an on-demand run, workflow_dispatch for a cron timetable and for an external API call, and schedule for a payload from outside. Each event has one source. schedule takes cron expressions, workflow_dispatch adds the Run workflow button and typed inputs, repository_dispatch carries a client_payload posted to the REST API, and push fires on commits.

    See it in a sample question
  • Writing a value to the wrong runner file

    The wrong answers pick a runner file that sounds close. GITHUB_OUTPUT is offered for an environment variable, GITHUB_ENV for a step output, GITHUB_PATH for either, and GITHUB_STEP_SUMMARY for values. Each file does one job. GITHUB_ENV sets environment variables for later steps, GITHUB_OUTPUT registers step outputs read as steps.meta.outputs.version, GITHUB_PATH prepends to PATH, and GITHUB_STEP_SUMMARY renders Markdown on the run summary page.

    See it in a sample question
  • Expecting a value to reach another job

    The wrong answers assume a job's environment, workspace or needs link carries its results to the next job. A value written to GITHUB_ENV stays in the job that wrote it, and needs only orders jobs and exposes outputs. A short value crosses through a job output read as needs.build.outputs.image_tag. A file needs actions/upload-artifact in the producing job and actions/download-artifact in the consuming one, because each job runs on a separate runner.

    See it in a sample question
  • Swapping what the matrix strategy keys do

    The wrong answers reach for a neighbouring strategy key. exclude is offered to add a job, include to remove one, max-parallel to drop combinations or to cancel sibling jobs, and fail-fast to cap concurrency. include adds a combination or augments a matching one, exclude removes matching combinations, max-parallel caps how many jobs run at once, and fail-fast: false stops one failure cancelling the other jobs.

    See it in a sample question
  • Using the wrong hostname for a service container

    The wrong answers pick the hostname that belongs to the other setup. A job on the runner host reaches a service at localhost on a published ports mapping, because the service label does not resolve outside the Docker network. A job inside a container reaches it by the service label, such as mysql, because localhost then points at the job container. host.docker.internal reaches the Docker host, not a sibling service container.

    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 manage workflowsmedium

An engineer needs to let teammates start a release workflow on demand from the Actions tab and have them choose a deployment environment from a typed field when they do. Which trigger configuration meets both requirements?

on:
  <trigger>:
    inputs:
      environment:
        type: choice
        options: [staging, production]
  • Aschedule, with an inputs block listing the environment choices, so the run is launched on demand and reads the selected value.
  • Bworkflow_dispatch, because it adds a manual run button in the Actions tab and supports an inputs block including typed choice fields. Correct
  • Cpush, with branch filters mapped to the inputs choices, so pushing to a branch starts the run and selects the matching environment.
  • Drepository_dispatch, because it shows a manual button in the Actions tab and exposes the same inputs choices to the person starting the run.
Use workflow_dispatch to expose a manual run button with typed inputs such as a choice field. Only the workflow_dispatch event adds a Run workflow button in the Actions tab and supports an inputs block, where a field can be declared as type choice with a fixed set of options. That combination gives teammates an on-demand launch and a typed environment selector. The schedule and push events fire automatically and accept no inputs, and repository_dispatch is driven by an API call rather than a tab button.

Why A is wrong: Tempting because inputs look plausible under any event, but schedule fires only on a cron timer, offers no manual launch button, and does not accept an inputs block at all.

Why B is correct: The workflow_dispatch event enables a manual run control in the Actions tab and accepts an inputs block, so a choice-typed environment field is presented for the operator to select before the run.

Why C is wrong: Tempting because push starts runs from developer activity, but it fires automatically on commits rather than on demand and provides no typed input prompt for the operator to choose an environment.

Why D is wrong: Tempting because it is also manually driven, but repository_dispatch is started by an API call carrying a client_payload, not by an Actions tab button, and it does not render a typed inputs form.

Free sampleAuthor and manage workflowsmedium

Inside one job, a step with the id meta computes a release tag and a later step must read it as ${{ steps.meta.outputs.tag }}. The author wants the step to register the output using the current supported workflow command rather than a removed one. Which command should the meta step run?

  • AEmit the removed set-output workflow command, for example echo "::set-output name=tag::$VALUE", which once wrote to the steps context.
  • BEcho the pair to the environment file, for example echo "tag=$VALUE" >> "$GITHUB_ENV", which exposes it through the steps context.
  • CEcho the pair to the output file, for example echo "tag=$VALUE" >> "$GITHUB_OUTPUT", which registers a step output named tag. Correct
  • DEcho the pair to the summary file, for example echo "tag=$VALUE" >> "$GITHUB_STEP_SUMMARY", which records it as a step output.
A step registers an output by appending name=value to the file named by GITHUB_OUTPUT, replacing the removed set-output command. GitHub replaced the ::set-output:: workflow command with file-based output. A step writes name=value lines to the path in the GITHUB_OUTPUT environment variable, and those become available to later steps in the same job through steps.<step-id>.outputs.<name>.

Why A is wrong: The ::set-output:: workflow command was the former mechanism but has been removed, so although it looks familiar it no longer registers the output and would warn or fail.

Why B is wrong: Writing to GITHUB_ENV creates an environment variable read through the env context, not a step output read through steps.<id>.outputs, so the reference would resolve empty.

Why C is correct: Appending name=value to the file referenced by GITHUB_OUTPUT is the current supported way to set a step output, which later steps read through the steps context.

Why D is wrong: GITHUB_STEP_SUMMARY only adds Markdown to the run summary page and never registers a value the steps context can read, so it cannot supply a step output.

Free sampleAuthor and manage workflowsmedium

A compile job produces a binary that a later test job, declared with needs on the compile job, must consume on a fresh runner that never shares a filesystem with the compile job. The author needs the supported way to hand the file from one job's runner to the other. Which approach transfers the binary correctly?

compile:
  steps:
    - run: ./build.sh   # produces dist/app
test:
  needs: compile
  steps:
    - run: ./dist/app --selftest
  • ASet dist/app as a job output from compile using GITHUB_OUTPUT, then have the test job read needs.compile.outputs.binary, because job outputs carry file contents between runners.
  • BHave the compile job upload dist/app with actions/upload-artifact@v4, and have the test job restore it with actions/download-artifact@v4, because artifacts move files between jobs on separate runners. Correct
  • CCache dist/app in the compile job with actions/cache@v4 under a fixed key, because a cached path is automatically mounted into every dependent job that lists compile under needs.
  • DWrite the path dist/app to the GITHUB_ENV file in compile, because the env context shared across the needs relationship lets the test job open the file at that same path.
Move a file between jobs on separate runners by uploading it as an artifact and downloading it in the dependent job, since outputs only carry strings. Jobs run on independent runners with no shared filesystem, so a compiled file cannot be passed through job outputs or environment variables, which only carry string values. The supported mechanism is actions/upload-artifact in the producing job and actions/download-artifact in the consuming job. actions/cache is built for cross-run reuse keyed by content and is not an automatic same-run, job-to-job file mount.

Why A is wrong: Tempting because job outputs do cross jobs, but they pass short string values, not files. A compiled binary cannot be transferred as a step or job output through GITHUB_OUTPUT.

Why B is correct: Each job runs on its own runner with no shared disk, so a file is moved by uploading it as an artifact in the producing job and downloading it in the dependent job, which is exactly what these actions do.

Why C is wrong: Tempting because caching stores a path, but a cache is keyed for reuse across runs and is restored only by an explicit cache step, not auto-mounted into a dependent job within the same run.

Why D is wrong: Tempting because GITHUB_ENV stores values, but it only shares a string path, not the file, and the test job's separate runner has no such file at that path anyway.

Free sampleAuthor and manage workflowshard

A matrix builds the same package across several runner versions. The team wants every matrix job to run to completion and report its own result even when one version fails early, so they can see the full compatibility picture in a single run. Which strategy setting achieves this default-overriding behaviour?

strategy:
  <key>: false
  matrix:
    version: [1.19, 1.20, 1.21, 1.22]
  • Amax-parallel: false, because the default cancels the slower matrix siblings once any job fails, and disabling it lets every version finish and report independently.
  • Bcontinue-on-error: false, because the default cancels the remaining matrix siblings once any job fails, and disabling it lets every version finish and report independently.
  • Cfail-fast: false, because the default cancels in-progress and queued matrix siblings once any job fails, and disabling it lets every version finish and report independently. Correct
  • Dcancel-in-progress: false, because the default cancels the queued matrix siblings once any job fails, and disabling it lets every version finish and report independently.
Set fail-fast to false so a matrix runs every combination to completion instead of cancelling siblings on the first failure. Under a matrix, fail-fast defaults to true, so the first failing job cancels all in-progress and pending siblings. Setting fail-fast to false overrides that default, letting every version build and report its own status for a complete compatibility matrix. max-parallel takes a number, continue-on-error is already false and only affects one job, and cancel-in-progress is a concurrency key, not a strategy key.

Why A is wrong: Tempting because it borrows the right wording, but max-parallel expects a number, not a boolean, and it limits concurrency rather than cancelling siblings on failure, so it cannot deliver this.

Why B is wrong: Tempting because it deals with failure, but continue-on-error defaults to false already and only marks a single failing job as non-fatal. It does not stop the matrix from cancelling siblings.

Why C is correct: fail-fast defaults to true, cancelling sibling jobs when one fails, so setting it to false keeps every version running to completion and surfaces each result for the full compatibility view.

Why D is wrong: Tempting because the name suggests cancellation control, but cancel-in-progress belongs to concurrency for superseding runs, not to strategy, so it has no effect on matrix sibling behaviour.

Free sampleAuthor and manage workflowsmedium

A test job runs directly on a GitHub-hosted runner, not inside a job container, and defines a Redis service container so the tests can reach it. The author needs the steps, which run on the runner host, to connect to Redis at localhost on the standard port. Which addition to the service definition makes Redis reachable from the host this way?

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      redis:
        image: redis
  • AMap the container port to the host with a ports entry such as ports: ['6379:6379'] so the service is published on localhost. Correct
  • BAdd a hostname entry such as hostname: redis so the steps can resolve the service by its container name on the runner.
  • CAdd an options entry such as options: --network host so the container shares the runner's network namespace directly.
  • DAdd a volumes entry such as volumes: ['/data:/data'] so the runner and the Redis container share a mount point.
When a job runs on the runner host, a service container is reachable only through a published host port declared with the ports key. Service containers join a Docker network that is directly addressable only from a job container. A job running on the runner host has no name resolution for that network, so the runner must publish the container port to the host with a ports mapping, after which steps connect at localhost on the mapped port.

Why A is correct: When the job runs on the runner host rather than in a container, steps reach a service only through a published host port, so a ports mapping under the service exposes Redis at localhost:6379.

Why B is wrong: Reaching a service by its label as a hostname works only when the job itself runs inside a container on the same Docker network, not for steps executing on the host.

Why C is wrong: Passing extra Docker flags through options does not replace the supported ports publishing mechanism, and host networking is not how Actions exposes service ports to host steps.

Why D is wrong: A volume shares a filesystem path, not a network endpoint, so it does nothing to let host steps reach the Redis service over a TCP port.

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.