GH-200 Sample Questions & Answers
Writing and maintaining workflows, including triggers, secrets and environment variables, makes up the largest portion, ahead of building custom actions, interpreting runs and locating logs and artifacts, and running Actions across the enterprise.
Launch the full GH-200 simulator →Showing 8 of 17 free samples.
- Question 1IntermediateSelect 2
Author and maintain workflows · Use the components of a workflow
You need to select a runner for a job that requires a Linux environment with 64GB of RAM and custom GPU drivers installed. You have configured a self-hosted runner with these specifications and assigned it the labels:
linux,x64,gpu, andhigh-mem.Which
runs-onconfiguration ensures the job lands on this specific runner or one with identical capabilities? (Select TWO)Show answer & explanation
Correct answers: B, C
When providing an array to
runs-on, GitHub Actions selects a runner that matches ALL specified labels. This ensures the job runs on a self-hosted Linux machine with the required high-mem and gpu capabilities.Using the explicit group and labels syntax is also a valid way to target self-hosted runners, ensuring the runner is picked from a specific group and matches the required labels.
- Question 2Intermediate
Author and maintain workflows · Use encrypted secrets and environment variables
A developer defines an environment variable
API_KEYat the workflow level, but redefines it with a different value in a specific job, and again within a specific step.When the step executes, which value of
API_KEYwill be used?Show answer & explanation
Correct answer: D
GitHub Actions follows a specific precedence order for environment variables: Step level > Job level > Workflow level. The most specific definition (step level) overrides broader definitions.
- Question 3Intermediate
Author and maintain workflows · Use encrypted secrets and environment variables
You are maintaining a public repository. A contributor submits a Pull Request from a forked repository. Your workflow normally runs integration tests using a secret
DB_PASSWORD.Why does the workflow fail when triggered by the PR from the fork?
Show answer & explanation
Correct answer: D
For security reasons, GitHub Actions prevents secrets from being accessed in workflows triggered by pull requests from forks. This prevents malicious code in a fork from stealing secrets. To support this, you typically use the
pull_request_targetevent with caution. - Question 4Intermediate
Author and maintain workflows · Create a workflow for a particular purpose
Your workflow requires a Redis database for integration testing. You want to configure a service container for Redis that is accessible to the job steps.
Which configuration correctly sets up the Redis service and maps the port?
Show answer & explanation
Correct answer: B
This configuration defines a service named 'redis' using the 'redis' image and maps host port 6379 to container port 6379, making it accessible to the job steps via localhost:6379.
- Question 5Beginner
Author and maintain workflows · Use encrypted secrets and environment variables
True or False: The automatic
GITHUB_TOKENsecret always has read/write permissions to the repository contents by default, regardless of the organization or repository settings.Show answer & explanation
Correct answer: B
False. The default permissions for GITHUB_TOKEN can be configured at the organization or repository level to be 'Restricted' (read-only) or 'Permissive' (read/write). Best practice is to set default permissions to restricted and explicitly grant required permissions in the workflow file.
- Question 6Intermediate
Author and maintain workflows · Use the components of a workflow
You are using a matrix strategy to test your application on multiple Node.js versions (14, 16, 18) and Operating Systems (ubuntu-latest, windows-latest). However, you know that Node.js 14 is incompatible with windows-latest.
How do you exclude this specific combination from the matrix?
Show answer & explanation
Correct answer: C
The
excludekey allows you to define specific combinations of matrix variables that should be removed from the generated job set. This configuration removes the Windows + Node 14 job while keeping all others. - Question 7Advanced
Author and maintain workflows · Use the components of a workflow
Job A calculates a version number and needs to pass it to Job B. Job B depends on Job A.
Which command in Job A correctly exposes the version number, and how does Job B access it?
Show answer & explanation
Correct answer: A
To pass data between jobs, Job A must map a step output to a job output. The step writes to
$GITHUB_OUTPUT. Job B, whichneedsJob A, accesses the data via theneeds. .outputs.context. - Question 8Advanced
Author and maintain workflows · Use the components of a workflow
You have a step in your workflow that uploads test coverage reports. You want this step to execute even if the previous 'Run Tests' step failed, but NOT if the workflow was cancelled by a user.
Which condition should you use?
Show answer & explanation
Correct answer: A
The default behavior is
success(). To run on failure but not cancellation, you can generally useif: failure() || success()(or typically justif: !cancelled()in some contexts where you want it to run unless cancelled).always()runs even on cancellation.!cancelled()ensures it runs for success or failure, but stops if the user cancelled the run.
Ready for the real thing?
The full GH-200 simulator has every exam-style question, timed mode, and instant scoring.