GH-200 · Sample questions
GH-200 sample questions with answers and explanations
10 real questions from the CertifyDeck GH-200 bank, spread across the domains of the official GitHub Actions skills outline, with the correct answer and a full explanation of why the other options are wrong. They are original questions written from the public syllabus, not exam dumps, and they are the same style you will find in the practice tests and mock exams.
- Question 1Domain: Consume and troubleshoot workflowsMedium
A job uses this matrix: strategy: matrix: os: [ubuntu-latest, windows-latest] node: [20, 22] include: - node: 22 coverage: true - os: windows-latest shell: pwsh A failure appears only in the job where matrix.coverage is true and matrix.shell is pwsh. Which combination is that job?
- A.os windows-latest with node 22
- B.os windows-latest with node 20
- C.An extra job built only from include
- D.os ubuntu-latest with node 22
Show answer and explanation
Correct answer: A. os windows-latest with node 22
Explanation
An include entry whose keys match an original combination adds its new keys to every combination it can extend without overwriting a value. coverage: true is added to both node 22 jobs, and shell: pwsh is added to both windows-latest jobs, so only windows-latest with node 22 has both. The node 20 Windows job lacks coverage, the Ubuntu node 22 job lacks shell, and no extra job is created because both entries extend existing combinations.
Official references
- Question 2Domain: Consume and troubleshoot workflowsEasy
A developer wants to inspect, on a laptop, only the test-report artifact produced by workflow run 9917355. The run also produced three other artifacts that the developer does not need. Which GitHub CLI command should the developer use?
- A.gh run download 9917355 -n test-report
- B.gh run download 9917355
- C.gh run download -n test-report --dir ./reports
- D.gh run view 9917355 --log
Show answer and explanation
Correct answer: A. gh run download 9917355 -n test-report
Explanation
gh run download with a run ID and -n downloads just the named artifact from that specific run. Without -n the command downloads every artifact of the run, which fails the requirement to fetch only one. Omitting the run ID makes the CLI look for matching artifacts across runs in the repository rather than in run 9917355, and gh run view --log shows logs, not artifacts.
Official references
- Question 3Domain: Author and manage workflowsMedium
Your tests need MySQL started with the server flag --sql_mode=STRICT_TRANS_TABLES. You want to keep using the public mysql:8 image without building a custom image. What should you add to the service definition?
- A.env with SQL_MODE: STRICT_TRANS_TABLES
- B.entrypoint: --sql_mode=STRICT_TRANS_TABLES
- C.options: --sql_mode=STRICT_TRANS_TABLES
- D.command: --sql_mode=STRICT_TRANS_TABLES
Show answer and explanation
Correct answer: D. command: --sql_mode=STRICT_TRANS_TABLES
Explanation
command overrides the image's default CMD and its value is passed as arguments after the image name in docker create, which is how the docs pass flags to mysql:8 while keeping the image entrypoint. options holds docker create options for the container, not arguments for the server. entrypoint replaces the executable that runs, so a flag there is not a valid entrypoint, and env only sets environment variables in the container.
Official references
- Question 4Domain: Author and manage workflowsMedium
A job on the feature branch uses actions/cache with the following inputs. No cache exists with the key npm-feature-d5ea0750, but the branch has two caches whose keys start with npm-feature-, created yesterday and today. with: path: ~/.npm key: npm-feature-${{ hashFiles('package-lock.json') }} restore-keys: | npm-feature- npm- What happens when the step runs?
- A.The cache created yesterday is restored, because the oldest match is preferred.
- B.The cache created today is restored, and the cache-hit output is not true.
- C.No cache is restored, because restore-keys are used only when the key matches.
- D.The step fails, because the restore key npm-feature- matches more than one cache.
Show answer and explanation
Correct answer: B. The cache created today is restored, and the cache-hit output is not true.
Explanation
On a cache miss for key, the action checks restore-keys in the order given, matching them as prefixes, and when several caches match a restore key it restores the most recently created one. cache-hit is true only for an exact match of the primary key, so it is not true here. restore-keys exist precisely for the miss case, and multiple partial matches do not cause a failure.
Official references
- Question 5Domain: Manage GitHub Actions for the enterpriseMedium
You maintain an organization workflow template that builds and scans container images. You want it to be offered only in repositories that have a Dockerfile in their root directory. What should you configure?
- A.A categories entry named Dockerfile in the template's metadata file
- B.A paths filter for Dockerfile under on.push in the template's workflow file
- C.A hashFiles('Dockerfile') check in a job-level if: in the template
- D.A filePatterns entry such as ^Dockerfile in the template's metadata file
Show answer and explanation
Correct answer: D. A filePatterns entry such as ^Dockerfile in the template's metadata file
Explanation
The optional filePatterns field allows the template to be used if the user's repository has a file in its root directory that matches a defined regular expression. A paths filter and a job-level condition only affect when a workflow runs after it has been added, and categories only define the groupings under which the template is shown.
Official references
- Question 6Domain: Manage GitHub Actions for the enterpriseMedium
Your organization on GitHub Team trains machine learning models in GitHub Actions. Jobs fail with memory errors on standard GitHub-hosted runners, and some jobs need a GPU. The team does not want to provision, patch or maintain any runner machines. Which runner choice should you recommend?
- A.Standard GitHub-hosted runners with the job running in a container:
- B.Actions Runner Controller scale sets on a GPU Kubernetes cluster
- C.Self-hosted runners on GPU servers that the company already owns
- D.GitHub-hosted larger runners, including GPU-powered runners
Show answer and explanation
Correct answer: D. GitHub-hosted larger runners, including GPU-powered runners
Explanation
Larger runners are GitHub-hosted virtual machines with more RAM, CPU and disk space, including GPU-powered runners, and GitHub maintains them, so they meet both the resource need and the no-maintenance requirement. Self-hosted runners and Actions Runner Controller leave you responsible for the machines or cluster, and running a job in a container on a standard runner does not add resources.
Official references
- Question 7Domain: Author and maintain actionsMedium
You maintain a JavaScript action whose action.yml contains: runs: using: 'node24' main: 'dist/index.js' The code in src/index.js imports @actions/core. Your .gitignore excludes node_modules and dist, so only src/index.js, package.json and action.yml were pushed. Workflows that use the action fail because the code and its dependencies cannot be found. What should you do?
- A.Change main to 'src/index.js' so that the runner starts the committed source file.
- B.Add pre: 'npm install' under runs so that dependencies install before main starts.
- C.Bundle the code and dependencies into dist/index.js and commit that file.
- D.Ask consumers to add a run: npm install step before the step that uses the action.
Show answer and explanation
Correct answer: C. Bundle the code and dependencies into dist/index.js and commit that file.
Explanation
GitHub downloads the action at runtime and runs it as a complete package, so every dependency must be in the repository; the documented approach is to compile code and dependencies into one file such as dist/index.js with rollup.js or @vercel/ncc. Pointing main at src/index.js still leaves @actions/core missing. A consumer npm install step runs in the workflow workspace, not in the downloaded action, and pre expects a script file for the Node.js runtime, not a shell command.
Official references
- Question 8Domain: Author and maintain actionsMedium
You are preparing the action.yml of a packaging action so that it shows a personalized badge next to its name in GitHub Marketplace. Which branding block is valid?
- A.branding: with icon: 'package' and color: 'purple'
- B.branding: with icon: 'github' and color: 'purple'
- C.branding: with icon: 'package' and color: '#6f42c1'
- D.branding: with icon: 'package' and color: 'teal'
Show answer and explanation
Correct answer: A. branding: with icon: 'package' and color: 'purple'
Explanation
branding.icon takes a supported Feather icon name such as package, and branding.color must be one of the named values white, black, yellow, blue, green, orange, red, purple or gray-dark. A hex code and teal are not in that list of colors. Brand icons are omitted from the supported icons, so github cannot be used.
Official references
- Question 9Domain: Secure and optimize automationEasy
Your team's repository holds a web front end in the frontend directory, and the only lockfile is frontend/package-lock.json. The CI job reinstalls npm packages on every run: - uses: actions/setup-node@v6 with: node-version: 22 cache: npm You want setup-node to key its npm cache on that lockfile with the least configuration. What should you do?
- A.Add cache-dependency-path: frontend/package-lock.json to the setup-node step.
- B.Upload frontend/node_modules with actions/upload-artifact and a short retention-days.
- C.Replace the cache input with an actions/cache step that caches frontend/node_modules.
- D.Add package-manager-cache: true to the setup-node step next to the cache input.
Show answer and explanation
Correct answer: A. Add cache-dependency-path: frontend/package-lock.json to the setup-node step.
Explanation
setup-node looks for the dependency file in the repository root and hashes it into the cache key; cache-dependency-path is the input for lockfiles located in subdirectories. Writing your own actions/cache step works but needs more configuration, which fails the stated requirement. package-manager-cache only turns automatic npm caching on or off, and artifacts are meant for job outputs, not for reusing dependencies between runs.
Official references
- Question 10Domain: Secure and optimize automationMedium
A busy open source repository has dozens of pull requests open at any time. The cache list shows that caches for the default branch are being created and deleted at a high frequency, because caches restricted to pull request branches use most of the cache storage. Pull request runs must keep using caches while they are open, and you must not increase storage costs. What should you do?
- A.Raise the repository's maximum cache storage size in the Actions settings.
- B.Add restore-keys so pull request runs fall back to the default branch caches.
- C.Declare cache-mode: none on the jobs triggered by the pull_request event.
- D.Delete each pull request's caches with gh cache delete when it is closed.
Show answer and explanation
Correct answer: D. Delete each pull request's caches with gh cache delete when it is closed.
Explanation
To prevent cache thrashing, the docs recommend deleting caches faster than the eviction policy would, for example with a workflow on pull_request closed that runs gh cache delete for the refs/pull/<number>/merge ref. Raising the cache size reduces eviction but adds cost, which the requirement rules out. cache-mode: none stops pull request runs from using caches at all, and restore-keys change which cache is restored without freeing any storage.
Official references
How to use these GH-200 sample questions
Answer each question before opening the explanation, and write down why you discarded the other options. On GH-200, most mistakes come from choosing an option that is technically possible but does not meet every requirement in the scenario.
These 10 questions are a taste of the format, not a diagnostic. To know which domains you fail, practice by domain for free and take a timed mock exam that mirrors the official weights and duration.
Practice GH-200 with hundreds more questions
Start for free, no sign-up or card. Every question includes an explanation like the ones above, and the mock exam reproduces the official GH-200 format.