GitHub Actions Free Sample Questions

Create a free account to browse all 17 sample questions. The full practice test includes 250 questions. Use the simulator for timed and flashcard mode.

Try Simulator

GH-200 Sample Questions

  1. Question 1

    Q1

    You are architecting a CI/CD workflow for a monorepo containing a frontend application (in /client) and a backend API (in /api). You need to configure the workflow to trigger ONLY when changes are pushed to the main branch affecting the backend API code. Changes to documentation (Markdown files) inside the api directory should NOT trigger the workflow.

    Which trigger configuration should you use?

    Show answer & explanation

    Correct answer: A

    This configuration correctly targets the 'main' branch and uses 'paths' to include the api directory while simultaneously using 'paths-ignore' to exclude markdown files within that structure. Both filters are evaluated to determine if the workflow runs.

  2. Question 2

    Q2

    A DevOps engineer is configuring a scheduled workflow that must run every Monday at 8:00 AM UTC. The workflow is critical for weekly reporting.

    Which cron schedule expression correctly implements this requirement?

    Show answer & explanation

    Correct answer: A

    GitHub Actions uses POSIX cron syntax: Minute, Hour, Day of Month, Month, Day of Week. '0 8 * * 1' translates to Minute 0, Hour 8, Any Day of Month, Any Month, Day of Week 1 (Monday).

  3. Question 3

    Q3

    You are creating a workflow that accepts manual inputs to deploy a specific version of an application to a chosen environment. You need to ensure the environment input can only be one of three values: 'dev', 'staging', or 'prod'.

    How should you define this input in the workflow_dispatch trigger?

    Show answer & explanation

    Correct answer: A

    The choice input type renders a dropdown menu in the GitHub UI, restricting the user to select from the provided options list. This enforces the constraint at the UI level.

  4. Question 4

    Q4

    CASE STUDY: GlobalLogistics Corp

    GlobalLogistics has a complex deployment pipeline. The workflow deploy.yml consists of three jobs: build, test, and deploy.

    Requirements:

    1. build must run first.
    2. test must run only if build succeeds.
    3. deploy must run only if test succeeds.
    4. If test fails, a special cleanup job called report-failure must run to upload logs to an S3 bucket.

    How should you configure the report-failure job dependencies?

    Show answer & explanation

    Correct answer: A

    To run a job after another job has failed, you must declare the dependency using needs: test (so it waits for test to finish) and use the if: failure() conditional check to ensure it only executes when the dependent job has failed.

  5. Question 5

    Q5Multiple answers

    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, and high-mem.

    Which runs-on configuration ensures the job lands on this specific runner or one with identical capabilities? (Select TWO)

    Show answer & explanation

    Correct answers: A, B

    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.

  6. Question 6

    Q6

    A developer defines an environment variable API_KEY at 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_KEY will be used?

    Show answer & explanation

    Correct answer: A

    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.

  7. Question 7

    Q7

    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: A

    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_target event with caution.

  8. Question 8

    Q8

    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: A

    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.

Register free to unlock 9 more sample questions

Create a free account to continue with the rest of the GH-200 sample set.

Lifetime One

Own this practice test forever.

$79.99
$75.99
one-time
  • Full access to 250 questions
  • Study, Timed & Flashcard Modes
  • All past and future versions i
  • Detailed Explanations
  • Study Tracking & Past Attempts
  • Brainy AI Assistant
  • Lifetime updates

Two

Any 2 exams per month.

$20.00/exam
$39.99
/month
  • 2 active exam slots
  • Study, Timed & Flashcard Modes
  • All past and future versions i
  • Detailed Explanations
  • Study Tracking & Past Attempts
  • 1,000 Brainy AI Credits
  • Cancel anytime

Premium Twelve

Any 12 exams over 3 months.

$15.00/exam
$179.99
/3 months
  • 4 active exam slots
  • Study, Timed & Flashcard Modes
  • All past and future versions i
  • Detailed Explanations
  • Study Tracking & Past Attempts
  • 15,000 Brainy AI Credits
  • Dedicated support
  • Friend seat included — full access

Trusted by professionals at

NvidiaSupabaseGitHubOpenAITursoClerkClaude AIAmazon