CertSafari

    Free GitHub Actions Expert (GH-200) Sample Questions

    35 free sample questions from our bank of 335+, covering every exam domain, with answers and detailed explanations. Updated August 2026.

    Domain 1: Author and manage workflows

    Subdomain 1.2: Design and implement workflow structure

    1.Your CI workflow runs integration tests that require a PostgreSQL database. You want to provide a clean database instance for each workflow run without manually managing infrastructure. How should you configure this in the workflow?

    1. A.Adding a service container for PostgreSQL
    2. B.Installing PostgreSQL on the runner
    3. C.Using an action from the marketplace
    4. D.Managing a Docker container manually
    Show answer & explanation

    Correct answer: AAdding a service container for PostgreSQL

    • A. Adding a service container for PostgreSQL in the workflow YAML allows GitHub Actions to automatically spin up a PostgreSQL instance as a sidecar. This provides a clean, isolated database for each workflow run without manual setup.
    • B. Installing PostgreSQL on the runner requires manual setup and may leave residual data between runs. It does not leverage the ephemeral nature of runners and adds cleanup overhead.
    • C. Marketplace actions can assist with setup, but they do not inherently provide a clean, isolated database instance. Service containers are the native and recommended method.
    • D. Manually managing a Docker container requires you to handle the container lifecycle yourself, defeating automation. GitHub Actions service containers automate this process.

    Subdomain 1.2: Design and implement workflow structure

    2.You need to pass a value computed in the build job to the deploy job in the same workflow. What is the recommended method?

    1. A.Define a job output and reference it via the needs context
    2. B.Set a global environment variable using GITHUB_ENV
    3. C.Write the value to a file and upload it as an artifact
    4. D.Use a service container to share data between jobs
    Show answer & explanation

    Correct answer: ADefine a job output and reference it via the needs context

    • A. Correct. GitHub Actions allows jobs to define outputs, which can be referenced in dependent jobs using the `needs` context. This is the recommended and most efficient mechanism for passing computed values between jobs in the same workflow.
    • B. Incorrect. Environment variables set via `GITHUB_ENV` are scoped only to the current job and its subsequent steps. They cannot be shared across jobs.
    • C. Incorrect. While artifacts can transfer files between jobs, they are not the recommended method for passing simple values. Using an artifact introduces extra steps and complexity compared to job outputs.
    • D. Incorrect. Service containers are used to provide supporting services like databases for jobs, not to share computed data between jobs.

    Subdomain 1.2: Design and implement workflow structure

    3.Your organization uses the windows-latest runner label. Microsoft has announced that windows-latest will migrate from Windows Server 2019 to Windows Server 2025. What potential impacts should your team plan for?(Select 2)

    1. A.Workflow failures if scripts depend on specific PowerShell or older OS features
    2. B.All legacy applications will run without modification on the new image
    3. C.You can preview the new image by using windows-2025 before the migration
    4. D.GitHub will force an immediate switch to the new image with no notice
    5. E.You must use a self-hosted runner with Windows Server 2019 to continue
    Show answer & explanation

    Correct answers: A, CWorkflow failures if scripts depend on specific PowerShell or older OS features; You can preview the new image by using windows-2025 before the migration

    • A. Correct. Workflows may fail if they rely on specific PowerShell versions or deprecated OS features that are no longer available in Windows Server 2025. Teams should test their scripts and dependencies against the new image to avoid failures.
    • B. Incorrect. Moving to a newer runner image does not guarantee compatibility. Legacy applications may require modifications due to breaking changes or removal of older frameworks.
    • C. Correct. GitHub typically provides preview labels such as windows-2025 to allow users to test workflows on the new image before the official migration of windows-latest. This lets teams validate and fix issues in advance.
    • D. Incorrect. GitHub and Microsoft announce hosted runner image changes in advance, providing a transition period. The switch is not immediate or without notice.
    • E. Incorrect. Using a self-hosted runner is an option but not a requirement. Teams can adapt by pinning to a supported image label or updating their workflows rather than being forced to use self-hosted runners.

    Subdomain 1.2: Design and implement workflow structure

    4.You are writing a workflow and have a deploy job that must run only after the build and test jobs complete successfully. You add the line `_____: [build, test]` under the deploy job definition.

    1. A.needs
    2. B.runs-on
    3. C.if
    Show answer & explanation

    Correct answer: Aneeds

    • A. Correct. The `needs` keyword defines job dependencies. Adding `needs: [build, test]` ensures the deploy job runs only after both build and test jobs complete successfully.
    • B. Incorrect. The `runs-on` keyword specifies the runner environment for a job (e.g., `ubuntu-latest`), not job dependencies.
    • C. Incorrect. The `if` keyword is used for conditional execution of steps or jobs based on a condition, not for defining dependencies.

    Subdomain 1.3: Manage workflow execution and outputs

    5.A workflow has two jobs: `build` and `deploy`. The `build` job compiles a binary and needs to make it available to the `deploy` job. The developer uses `actions/upload-artifact@v3` to upload the binary with name `my-app`. In the `deploy` job, they use `actions/download-artifact@v3` but the download step fails with "No artifact with name 'my-app' found" despite the upload succeeding. Which configuration is most likely causing the issue?

    1. A.The `deploy` job is missing `needs: build`, so it may run before the artifact is ready.
    2. B.The `download-artifact` action requires specifying the artifact's path as an input.
    3. C.The artifact name in the upload step is case-sensitive and must be quoted.
    4. D.The artifact retention period has expired before the `deploy` job started.
    Show answer & explanation

    Correct answer: AThe `deploy` job is missing `needs: build`, so it may run before the artifact is ready.

    • A. Without `needs: build`, the `deploy` job may run in parallel or before the `build` job completes, causing the artifact to not yet exist when the download is attempted. The error "No artifact with name 'my-app' found" occurs because the artifact hasn't been uploaded yet.
    • B. Incorrect. `actions/download-artifact@v3` does not require a path input to locate the artifact by name; the path is optional and only controls where the artifact is downloaded in the runner filesystem.
    • C. Incorrect. Artifact names are not case-sensitive in GitHub Actions, and quoting the name is not required unless it contains special characters. A naming mismatch could cause the error, but quoting is not the issue here.
    • D. Incorrect. The default artifact retention period is 90 days after the workflow run completes, not during the run. Within the same workflow run, artifacts are available until the run ends, so retention expiry cannot be the cause.

    Subdomain 1.3: Manage workflow execution and outputs

    6.A team wants to display the CI workflow status for the `develop` branch on their README. The workflow file is `ci.yml`. They add the following badge: `![CI](https://github.com/my-org/my-repo/actions/workflows/ci.yml/badge.svg)` The badge shows the status of the default branch instead of `develop`. What should they change?

    1. A.Append `?branch=develop` to the URL.
    2. B.Use a `actions/badge@v3` action to generate badge.
    3. C.Change the URL path to `/badge/develop.svg`.
    4. D.Set `BADGE_BRANCH=develop` in the workflow.
    Show answer & explanation

    Correct answer: AAppend `?branch=develop` to the URL.

    • A. Correct. GitHub Actions badge URLs support a `branch` query parameter to display the status for a specific branch. Appending `?branch=develop` tells GitHub to show the workflow status for the `develop` branch instead of the default branch.
    • B. Incorrect. The `actions/badge@v3` action is not a standard GitHub action for generating badges. GitHub provides built-in badge URLs for workflows, and no additional action is needed.
    • C. Incorrect. The path `/badge/develop.svg` is not a valid GitHub Actions badge URL. The correct badge URL uses the workflow file path with an optional `branch` query parameter to specify the branch.
    • D. Incorrect. There is no supported `BADGE_BRANCH` environment variable that affects the badge. The branch selection for the badge is controlled via the URL query parameter, not by workflow environment variables.

    Subdomain 1.3: Manage workflow execution and outputs

    7.A team wants to protect their production environment by requiring a reviewer from the DevOps team, delaying deployment by 10 minutes, and only allowing deployments from the `main` branch. Which of the following are valid protection rules they can configure for the environment? (Select all that apply.)(Select 3)

    1. A.Required reviewers
    2. B.Wait timer
    3. C.Deployment branches
    4. D.Branch protection rules
    5. E.Secret scanning
    Show answer & explanation

    Correct answers: A, B, CRequired reviewers; Wait timer; Deployment branches

    • A. Correct. Required reviewers is a valid environment protection rule that requires specified individuals or teams to approve deployments before they proceed.
    • B. Correct. Wait timer is a valid environment protection rule that introduces a mandatory delay before a deployment is executed, allowing time for manual intervention or verification.
    • C. Correct. Deployment branches is a valid environment protection rule that restricts deployments to only specified branches, such as `main`, ensuring controlled releases.
    • D. Incorrect. Branch protection rules apply to repository branches (e.g., requiring status checks before merging) and are not environment-specific deployment protection rules.
    • E. Incorrect. Secret scanning is a repository security feature that detects exposed secrets in code; it does not control deployment approvals, timing, or branch restrictions for environments.

    Subdomain 1.1: Configure workflow triggers and events

    8.A developer wants a workflow to run whenever a pull request is opened or reopened targeting the main branch. Which YAML trigger configuration should they use?

    1. A.on: pull_request: types: [opened, reopened] branches: [main]
    2. B.on: pull_request: types: [opened, synchronize] branches: [main]
    3. C.on: pull_request: types: [opened] branches: [main]
    4. D.on: pull_request: types: [reopened] branches: ['*']
    Show answer & explanation

    Correct answer: Aon: pull_request: types: [opened, reopened] branches: [main]

    • A. Correct. This configuration triggers on pull_request events of types 'opened' and 'reopened' and limits to the main branch, exactly matching the requirement to run when a PR is opened or reopened targeting main.
    • B. Incorrect. This uses 'synchronize' instead of 'reopened'. 'synchronize' triggers when new commits are pushed to the PR, not when it is reopened. It does not include 'reopened', so it fails to meet the requirement.
    • C. Incorrect. This only triggers on 'opened' events for the main branch. It does not include 'reopened', so reopened pull requests would not trigger the workflow.
    • D. Incorrect. This triggers only on 'reopened' and uses a wildcard branch filter ('*') instead of limiting to main. It also lacks 'opened', so opened PRs would not trigger the workflow.

    Subdomain 1.1: Configure workflow triggers and events

    9.A developer wants a workflow that can be triggered manually with a required string input `environment` and an optional boolean input `debug`. Which of the following `workflow_dispatch` configurations CORRECTLY implement these requirements? (Select all that apply.)(Select 2)

    1. A.on: workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true type: string debug: description: 'Enable debug mode' required: false type: boolean default: false
    2. B.on: workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true type: string debug: description: 'Enable debug mode' required: false type: boolean
    3. C.on: workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true type: string debug: description: 'Enable debug mode' required: false type: bool default: false
    4. D.on: workflow_dispatch: inputs: environment: description: 'Deployment environment' type: choice options: - staging - production debug: description: 'Enable debug mode' required: false type: boolean default: false
    5. E.on: workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true type: string debug: description: 'Enable debug mode' type: boolean
    Show answer & explanation

    Correct answers: A, Bon: workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true type: string debug: description: 'Enable debug mode' required: false type: boolean default: false; on: workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true type: string debug: description: 'Enable debug mode' required: false type: boolean

    • A. Correct. `environment` is required and defined as a string; `debug` is optional with `required: false`, type `boolean`, and a default value. This meets all requirements.
    • B. Correct. `environment` is required and a string; `debug` is optional (`required: false`) and type `boolean`. A default is not required for an optional input.
    • C. Incorrect. The type for `debug` is `bool`, which is invalid. GitHub Actions uses `boolean` for boolean inputs.
    • D. Incorrect. `environment` is defined as a `choice` type with fixed options, not as a free-form string as required.
    • E. Incorrect. `debug` is missing `required: false`, making it implicitly required, which violates the requirement for it to be optional.

    Subdomain 1.1: Configure workflow triggers and events

    10.In a `workflow_dispatch` input, the __________ type provides a dropdown list in the GitHub UI.

    1. A.choice
    2. B.environment
    3. C.select
    Show answer & explanation

    Correct answer: Achoice

    • A. Correct. The `choice` type in a `workflow_dispatch` input creates a dropdown list in the GitHub UI, allowing users to select from predefined options.
    • B. Incorrect. The `environment` type is used to specify a deployment environment (e.g., production, staging) and does not create a dropdown list for user input. It is not an input type but a context-related concept.
    • C. Incorrect. While `select` might intuitively seem like a dropdown, GitHub Actions does not use this term for `workflow_dispatch` inputs. The correct term is `choice`.

    Domain 2: Consume and troubleshoot workflows

    Subdomain 2.3: Use and manage workflow templates

    11.You use a starter workflow to create a new workflow file for your repository. After committing the new workflow, what is its relationship to the original starter template?

    1. A.It remains linked to the original starter template.
    2. B.It becomes an independent copy that you can modify.
    3. C.It automatically syncs when the template is updated.
    4. D.It is read-only and cannot be customized.
    Show answer & explanation

    Correct answer: BIt becomes an independent copy that you can modify.

    • A. Incorrect. When you use a starter workflow, it creates a new workflow file that is not linked to the original template. Changes to the template do not automatically propagate to the committed workflow.
    • B. Correct. Using a starter workflow generates an independent copy in your repository. You can modify it as needed without affecting the original template.
    • C. Incorrect. The new workflow does not automatically sync with updates to the original starter template; it is a static copy at the time of creation.
    • D. Incorrect. The committed workflow is fully editable and customizable; starter workflows are meant to be customized after creation.

    Subdomain 2.3: Use and manage workflow templates

    12.Which of the following statements about reusable workflows are correct? (Select two.)(Select 2)

    1. A.They are defined in a separate YAML file.
    2. B.They are callable from any public repository.
    3. C.They are called using `jobs.<job_id>.uses`.
    4. D.They are always public and accessible.
    5. E.They are usable only within one repository.
    6. F.They are triggered by webhook events.
    Show answer & explanation

    Correct answers: A, CThey are defined in a separate YAML file.; They are called using `jobs.<job_id>.uses`.

    • A. Correct. Reusable workflows are defined in a separate YAML file, typically stored in the .github/workflows directory, and can be referenced by other workflows.
    • B. Incorrect. Reusable workflows can only be called from repositories that have access to the workflow file. Access depends on the visibility of the source repository and any configured permissions; they are not automatically callable from any public repository.
    • C. Correct. Reusable workflows are invoked using the jobs.<job_id>.uses syntax in a calling workflow, where <job_id> is the job identifier and uses points to the reusable workflow file.
    • D. Incorrect. Reusable workflows are not always public; they can be private if the repository containing them is private, and access is controlled by GitHub's permission model.
    • E. Incorrect. Reusable workflows are designed to be shared across workflows. They can be called from other repositories when permitted, not limited to a single repository.
    • F. Incorrect. Reusable workflows are not directly triggered by webhook events. They are called by other workflows using the uses syntax; only initial workflows can be triggered by events.

    Subdomain 2.3: Use and manage workflow templates

    13.You create a new repository using a template that includes a starter workflow. After creation, you edit the workflow to suit your needs. Several months later, the upstream template repository updates its starter workflow. How does this affect your repository's workflow?

    1. A.Your workflow is unaffected because it is now independent.
    2. B.A pull request is automatically created with the updates.
    3. C.The workflow automatically updates on the next push.
    4. D.You receive a notification to manually sync the changes.
    Show answer & explanation

    Correct answer: AYour workflow is unaffected because it is now independent.

    • A. Correct. When you create a repository from a template, the workflow files are copied and become independent. Subsequent updates to the template's starter workflow do not affect your repository's workflow, which remains as last edited. No automatic sync or notification occurs.
    • B. Incorrect. GitHub does not automatically create pull requests for template workflow updates. Your repository is not linked like a fork, and changes from the template must be manually applied if desired.
    • C. Incorrect. The workflow does not automatically update on a push when the source template changes. Your workflow file stays as it was copied and edited, independent of the template.
    • D. Incorrect. GitHub does not send notifications for template workflow updates. You would need to manually check the template repository and sync changes if needed.

    Subdomain 2.2: Access workflow artifacts and logs

    14.A developer is viewing the log output of a lengthy build step and needs to find a specific error message. How can they search the log in the GitHub UI?

    1. A.Click the 'Filter logs' text box above the job step output and type the error message.
    2. B.Expand the log panel and use the browser’s find functionality (Ctrl+F) to locate the error.
    3. C.Select all log text, copy it, and then search for the error within a text editor locally.
    4. D.Type the error into the GitHub search bar at the top-right while on the Actions tab.
    Show answer & explanation

    Correct answer: BExpand the log panel and use the browser’s find functionality (Ctrl+F) to locate the error.

    • A. Incorrect. GitHub Actions logs do not have a dedicated 'Filter logs' text box for searching within job step output. The UI relies on the browser's built-in find feature or manual navigation.
    • B. Correct. In the GitHub UI, the easiest way to search within a long log is to expand the log panel and use the browser’s native find functionality (Ctrl+F or Cmd+F). This searches the currently displayed log text and lets the developer jump directly to the error message.
    • C. Incorrect. While copying logs into a local editor and searching there would work, it is not a method for searching in the GitHub UI. The question asks specifically how to search the log in GitHub, so this is not the intended workflow.
    • D. Incorrect. The GitHub search bar is used to search repositories, issues, code, and other GitHub content, not to search inside a specific Actions log page. It will not locate text within an individual job's log output.

    Subdomain 2.2: Access workflow artifacts and logs

    15.Which of the following operations can be performed using the GitHub Actions REST API? (Select three.)(Select 3)

    1. A.Rerun a workflow run
    2. B.List artifacts for a run
    3. C.Download a log archive for a job
    4. D.Create a new workflow file
    5. E.Approve a deployment
    6. F.Retrieve secret values
    Show answer & explanation

    Correct answers: A, B, CRerun a workflow run; List artifacts for a run; Download a log archive for a job

    • A. Correct. The GitHub Actions REST API provides the `POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun` endpoint to rerun a workflow run, including rerunning all jobs or only failed jobs.
    • B. Correct. You can list artifacts for a workflow run using the `GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts` endpoint, which is useful for inspecting or downloading build outputs.
    • C. Correct. The API supports downloading log archives for a job via the `GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs` endpoint, allowing programmatic retrieval of logs for troubleshooting.
    • D. Incorrect. Creating a new workflow file is a repository content operation handled via the Contents API or Git operations, not through the Actions REST API.
    • E. Incorrect. Approving a deployment is managed by deployment protection rules and the Deployments API, not by the Actions REST API for workflow runs and artifacts.
    • F. Incorrect. Secret values cannot be retrieved through any GitHub API for security reasons; they are write-only and only accessible during workflow execution.

    Subdomain 2.2: Access workflow artifacts and logs

    16.The default retention period for GitHub Actions artifacts and logs is __________ days.

    1. A.30
    2. B.60
    3. C.90
    Show answer & explanation

    Correct answer: C90

    • A. Incorrect. The default retention period is 90 days, not 30 days.
    • B. Incorrect. The default retention period is 90 days, not 60 days.
    • C. Correct. GitHub Actions artifacts and logs are retained for 90 days by default unless a different period is configured at the repository or organization level.

    Domain 3: Author and maintain actions

    Subdomain 3.1: Create and troubleshoot custom actions

    17.You want to share a custom action across multiple repositories in your organization without publishing to the GitHub Marketplace. All repositories are in the same GitHub Enterprise organization. What is the recommended approach?

    1. A.Put the action in a public repository and reference it with its full URL.
    2. B.Create a private repo and grant each repository access via deploy keys.
    3. C.Publish the action to the organization's internal package registry.
    4. D.Store the action in an internal repository and use the `uses: owner/repo` syntax.
    Show answer & explanation

    Correct answer: DStore the action in an internal repository and use the `uses: owner/repo` syntax.

    • A. Incorrect. Using a public repository exposes the action broadly, which is unnecessary for internal sharing. Additionally, referencing with a full URL is not the standard pattern; actions are typically referenced using the `owner/repo` syntax.
    • B. Incorrect. Deploy keys provide read-only access to a single repository and are not scalable for sharing an action across multiple repositories. This adds complexity and is not a best practice for internal action sharing.
    • C. Incorrect. GitHub Actions custom actions are stored in repositories, not in package registries. The internal package registry is for distributing packages and artifacts, not for sharing workflow actions.
    • D. Correct. Storing the action in an internal (private) repository within the organization and referencing it with `uses: owner/repo` (optionally with a ref like a tag or SHA) is the recommended approach. This allows secure reuse across all repositories in the organization without publishing to the Marketplace.

    Subdomain 3.1: Create and troubleshoot custom actions

    18.You are troubleshooting a JavaScript action that uses `@actions/core` to set an output. The downstream step that reads the output receives an empty string. Which of the following is the most likely direct cause?

    1. A.The action implementation failed to invoke `core.setOutput` to set the output value.
    2. B.The action mistakenly used `core.exportVariable` to set the output, which does not work for outputs.
    3. C.The downstream step referenced the output with a typo in the step id or output name.
    4. D.The action's TypeScript source was not compiled to JavaScript before pushing to the repository.
    Show answer & explanation

    Correct answer: CThe downstream step referenced the output with a typo in the step id or output name.

    • A. Incorrect. While failing to invoke `core.setOutput` would prevent the output from being set, the question states the action *uses* `@actions/core` to set an output, implying the method was called. Even if it wasn't, the more common direct cause of an empty string in the downstream step is a reference error.
    • B. Incorrect. Using `core.exportVariable` sets an environment variable, not an action output. This would cause the output to not be set, but the most likely direct cause of the downstream step receiving an empty string is a typo in the output reference, not a misuse of the API.
    • C. Correct. A typo in the step id or output name in the downstream step's expression causes the output to resolve to an empty string because GitHub Actions cannot find the referenced output. This is a common and direct cause.
    • D. Incorrect. Failing to compile TypeScript would typically cause the action to fail to run at all, not just produce an empty output. The action appears to run, so this is unlikely.

    Subdomain 3.1: Create and troubleshoot custom actions

    19.You are creating a composite action that needs to conditionally run a step only when a certain input is set to `true`. How should you implement this?

    1. A.Add an `if` condition to the step: `if: ${{ inputs.my_input == 'true' }}`.
    2. B.Implement the conditional logic inside the `run` script using shell if statements.
    3. C.Create a separate action that only triggers based on the input value.
    4. D.Apply an `unless` condition to the step to skip when input is false.
    Show answer & explanation

    Correct answer: AAdd an `if` condition to the step: `if: ${{ inputs.my_input == 'true' }}`.

    • A. Correct. In GitHub Actions, step-level `if` conditionals are the standard mechanism to control execution based on inputs. The syntax `if: ${{ inputs.my_input == 'true' }}` is valid because action inputs are strings, so comparing to the string `'true'` correctly evaluates the condition.
    • B. Incorrect. While shell if statements can be used inside a `run` script, they do not prevent the step from starting; the step still runs and incurs overhead. The recommended approach is to use a step-level `if` condition to skip the step entirely when the condition is not met.
    • C. Incorrect. Creating a separate action for a simple conditional step is unnecessarily complex. Composite actions are designed to encapsulate multiple steps, including conditional ones, within a single action, without needing to outsource the logic.
    • D. Incorrect. GitHub Actions does not support an `unless` keyword on steps. The correct way to conditionally run a step is to use `if` with the appropriate expression; to skip when input is false, you would use `if: inputs.my_input == 'true'`.

    Subdomain 3.3: Distribute and maintain actions

    20.A developer wants to use a specific commit of a public action to ensure stability. How can they reference it in a workflow?

    1. A.`uses: owner/repo@main`
    2. B.`uses: owner/repo@<sha>`
    3. C.`uses: owner/repo@v1`
    4. D.`uses: owner/repo@latest`
    Show answer & explanation

    Correct answer: B`uses: owner/repo@<sha>`

    • A. Incorrect. Using `uses: owner/repo@main` references the latest commit on the `main` branch, which can change over time and does not guarantee a specific commit, thus not ensuring stability.
    • B. Correct. Using `uses: owner/repo@<sha>` pins the action to an exact commit by its SHA hash, providing immutability and stability. This is the recommended way to reference a specific version for reproducibility.
    • C. Incorrect. `v1` typically refers to a tag or release version, which may be updated to point to a different commit if the maintainer retags it. While more stable than a branch, it does not guarantee a specific commit.
    • D. Incorrect. `latest` is not a standard GitHub Actions reference syntax for actions. It does not pin to a specific commit and cannot ensure stability.

    Subdomain 3.3: Distribute and maintain actions

    21.Which file is mandatory in an action repository for publishing to the GitHub Marketplace?

    1. A.README.md
    2. B.action.yml
    3. C.Dockerfile
    4. D.package.json
    Show answer & explanation

    Correct answer: Baction.yml

    • A. Incorrect. While a README.md is strongly recommended for documentation and user guidance, it is not a mandatory requirement for publishing an action to the GitHub Marketplace.
    • B. Correct. The action.yml file (or action.yaml) is mandatory as it defines the action's metadata, inputs, outputs, and execution details. GitHub requires this file to recognize and publish the action in the Marketplace.
    • C. Incorrect. A Dockerfile is only required if the action uses a Docker container as its runtime. Many actions are written in JavaScript or as composite actions, which do not require a Dockerfile.
    • D. Incorrect. package.json is used for JavaScript/Node.js actions to manage dependencies, but it is not mandatory for Marketplace publishing. The essential file is the action metadata file (action.yml).

    Subdomain 3.3: Distribute and maintain actions

    22.What is the purpose of the 'branding' section in an action.yml file for the GitHub Marketplace?

    1. A.To show an icon and color on the Marketplace listing.
    2. B.To categorize the action on the GitHub Marketplace.
    3. C.To specify the license type of the action.
    4. D.To indicate whether the action is free or paid.
    Show answer & explanation

    Correct answer: ATo show an icon and color on the Marketplace listing.

    • A. Correct. The branding section is used to define visual metadata for the action, such as an icon and a color, which appear on the GitHub Marketplace listing. This enhances the action's visual identity and helps it stand out.
    • B. Incorrect. Categorization of actions on the GitHub Marketplace is handled by other metadata, such as categories or tags, not the 'branding' section.
    • C. Incorrect. The license type of an action is specified in the repository's LICENSE file or metadata, not in the 'branding' section of action.yml.
    • D. Incorrect. The pricing model (free or paid) for an action is configured in the GitHub Marketplace settings, not in the 'branding' section of action.yml.

    Subdomain 3.3: Distribute and maintain actions

    23.In semantic versioning for actions, the mutable tag such as `v1` should point to the latest ______ release within that major version.

    1. A.minor
    2. B.patch
    3. C.prerelease
    Show answer & explanation

    Correct answer: Bpatch

    • A. Incorrect. The major version tag like `v1` is not intended to track the latest minor release. In GitHub Actions semantic versioning, the major tag should point to the latest patch release within that major version to ensure users receive bug fixes while maintaining compatibility.
    • B. Correct. Per GitHub's recommendation, the mutable tag like `v1` should point to the latest patch release within major version 1. This allows consumers to automatically receive backward-compatible bug fixes and security updates.
    • C. Incorrect. Prerelease versions (e.g., beta, alpha) are not stable and should not be referenced by mutable major tags. Tags like `v1` are meant to point to stable releases only.

    Domain 4: Manage GitHub Actions for the enterprise

    Subdomain 4.2: Manage runners at scale

    24.To ensure a consistent and isolated build environment, you decide to run your job inside a custom Linux container on a GitHub-hosted runner. How do you specify this in your workflow?

    1. A.Use the container key at the job level and specify the image.
    2. B.Add a step that runs docker run before your build commands.
    3. C.Configure the hosted runner to boot from a custom VM image.
    4. D.Specify the container image in the strategy matrix for the job.
    Show answer & explanation

    Correct answer: AUse the container key at the job level and specify the image.

    • A. The `container` key at the job level allows you to specify a Docker image, ensuring all steps run in that isolated container on the GitHub-hosted runner. This is the standard method for job-level containerization.
    • B. Incorrect. While you can manually run `docker run` in a step, this does not isolate the entire job; the job runner still executes on the host. It is not the recommended approach for job-level containerization.
    • C. Incorrect. GitHub-hosted runners are pre-configured and managed by GitHub; they do not support booting from custom virtual machine images via workflow. Custom images are for self-hosted runners.
    • D. Incorrect. The `strategy.matrix` is used to define multiple job variations (different OS, versions, etc.), not to specify the container image for a job. The container image is set at the job level with the `container` key.

    Subdomain 4.2: Manage runners at scale

    25.You manage a fleet of self-hosted runners and want them to automatically update to the latest runner software version. Which configuration option enables this?

    1. A.Use the --auto-update flag when running config.sh to enable updates.
    2. B.Enable auto-update in the repository's Actions settings under runners.
    3. C.Runner automatically updates itself when idle without configuration.
    4. D.Schedule a cron script to periodically download and apply runner updates.
    Show answer & explanation

    Correct answer: CRunner automatically updates itself when idle without configuration.

    • A. Incorrect. The `--auto-update` flag is not a valid option for the `config.sh` setup command. Self-hosted runner updates are handled by the runner service itself, not via a setup flag.
    • B. Incorrect. Repository Actions settings control workflow permissions and other features, but they do not include an auto-update setting for self-hosted runners. Runner updates are managed on the runner machine.
    • C. Correct. Self-hosted runners are designed to automatically update themselves when a new runner version is available and the runner is idle. No additional configuration is required for this built-in behavior.
    • D. Incorrect. While scheduling a script to download and apply updates is possible, it is a manual operational workaround. The question asks for the built-in configuration option, which is the automatic update mechanism already present in the runner.

    Subdomain 4.2: Manage runners at scale

    26.Which of the following tools come preinstalled on the ubuntu-latest GitHub-hosted runner? (Select three.)(Select 3)

    1. A.Node.js
    2. B.Docker
    3. C.Google Cloud CLI
    4. D.Python
    5. E.AWS CLI
    6. F.Terraform
    Show answer & explanation

    Correct answers: A, B, DNode.js; Docker; Python

    • A. Correct. Node.js is preinstalled on the ubuntu-latest runner, commonly used for JavaScript applications.
    • B. Correct. Docker is preinstalled on the ubuntu-latest runner, enabling containerized workflows.
    • C. Incorrect. Google Cloud CLI is not preinstalled on the ubuntu-latest runner; it must be installed manually.
    • D. Correct. Python is preinstalled on the ubuntu-latest runner, widely used for scripting and automation.
    • E. Incorrect. AWS CLI is not preinstalled on the ubuntu-latest runner; it requires manual installation or an action.
    • F. Incorrect. Terraform is not preinstalled on the ubuntu-latest runner; it must be installed manually.

    Subdomain 4.2: Manage runners at scale

    27.Which of the following are requirements for a machine to act as a GitHub Actions self-hosted runner? (Select three.)(Select 3)

    1. A.Supports an operating system (Linux, Windows, or macOS).
    2. B.Maintains an always-on internet connection to GitHub.
    3. C.Requires a minimum of 8 GB of RAM for operation.
    4. D.Requires Docker to be installed and running.
    5. E.Can run the runner application as a service.
    6. F.Requires a static public IP address for communication.
    Show answer & explanation

    Correct answers: A, B, ESupports an operating system (Linux, Windows, or macOS).; Maintains an always-on internet connection to GitHub.; Can run the runner application as a service.

    • A. Correct. A self-hosted runner must run on a supported operating system, which includes Linux, Windows, or macOS. GitHub provides runner binaries for these platforms, making them baseline compatibility requirements.
    • B. Correct. The machine needs an always-on internet connection to GitHub to register, receive jobs, and send logs/results. The runner must maintain outbound communication to GitHub over the internet.
    • C. Incorrect. GitHub does not require a minimum of 8 GB of RAM for a self-hosted runner. While GitHub recommends at least 2 GB of RAM for the runner application, the actual hardware requirements depend on the workflows to be executed.
    • D. Incorrect. Docker is not a universal requirement for a self-hosted runner. It is only necessary if the workflows involve container-based jobs or Docker actions.
    • E. Correct. The runner application must be able to run as a service (or background process) to ensure it stays active, accepts jobs, and remains available across reboots.
    • F. Incorrect. A static public IP address is not a requirement. The runner only needs to be able to communicate outbound to GitHub; it can use any internet connection, including dynamic IPs.

    Subdomain 4.3: Manage encrypted secrets and variables

    28.A developer wants to store a sensitive API token in a repository but require that it only be available to workflows running on the main branch. Which approach satisfies this requirement? (Assume the token must not be usable in any other branch.)

    1. A.Add a repository secret and then include a branch condition in every workflow that uses the token.
    2. B.Create an environment, restrict its branches to main, and store the secret as an environment secret.
    3. C.Store the secret as a repository secret and then encrypt it using a branch-specific encryption key.
    4. D.Create an organization secret and then restrict its visibility to only the target repository.
    Show answer & explanation

    Correct answer: BCreate an environment, restrict its branches to main, and store the secret as an environment secret.

    • A. Incorrect. Repository secrets are available to all workflows in the repository regardless of branch. While branch conditions can prevent a workflow from running on non-main branches, the secret itself remains accessible if a workflow on another branch references it. Branch conditions do not scope the secret to the main branch.
    • B. Correct. GitHub Environments support branch restrictions, allowing you to limit an environment to specific branches (e.g., main). Storing the secret as an environment secret ensures it is only exposed to workflows that use that environment and comply with the branch restriction, effectively scoping the token to the main branch.
    • C. Incorrect. GitHub does not support branch-specific encryption keys for secrets. Repository secrets are stored encrypted at rest with a repository-level key, not a branch-specific key. This approach does not provide a valid mechanism to restrict the secret to the main branch.
    • D. Incorrect. Organization secrets restricted to a specific repository control which repository can access the secret, not which branch within that repository can use it. Any branch in the repository could still potentially use the secret unless further restricted by an environment or other mechanism.

    Subdomain 4.3: Manage encrypted secrets and variables

    29.A team configures a "staging" environment and wants to ensure that any job referencing that environment will only execute for the `release/*` branch pattern. How can this be enforced?

    1. A.Configure the workflow trigger with a branch filter limiting it to `release/*`.
    2. B.In the environment, set Deployment branches to allow only `release/*`.
    3. C.Add an `if` condition to the job that evaluates `github.ref` against the branch.
    4. D.Store the secret in a repository specifically designated for that branch.
    Show answer & explanation

    Correct answer: BIn the environment, set Deployment branches to allow only `release/*`.

    • A. Incorrect. A workflow trigger branch filter only controls when the workflow starts, not which branches can deploy to the environment. It does not enforce the branch restriction at the environment level.
    • B. Correct. GitHub Environments support deployment branch restrictions, which can limit environment usage to specific branches or branch patterns such as `release/*`. This is the proper way to ensure any job that references the environment only runs from allowed branches, enforcing the restriction at the environment level.
    • C. Incorrect. An `if` condition on the job can prevent execution, but it is only a workflow-level logic check and does not enforce the restriction at the environment level. It is also easier to bypass or misconfigure compared to environment protection rules.
    • D. Incorrect. Storing a secret in a separate repository does not enforce branch-based execution rules for an environment. Secrets and repository placement are unrelated to controlling which branches may deploy to or use an environment.

    Subdomain 4.3: Manage encrypted secrets and variables

    30.Which of the following scope levels are available for defining encrypted secrets in GitHub Actions? (Choose three.)(Select 3)

    1. A.Workflow level
    2. B.Job level
    3. C.Organization level
    4. D.Repository level
    5. E.Environment level
    6. F.Step level
    Show answer & explanation

    Correct answers: C, D, EOrganization level; Repository level; Environment level

    • A. Incorrect. Workflow level is not a valid scope for defining encrypted secrets. Workflows can only reference secrets defined at higher scopes, such as organization, repository, or environment.
    • B. Incorrect. Job level is not a supported scope for encrypted secrets. Jobs can consume secrets, but secrets are defined and stored at broader scopes.
    • C. Correct. Organization-level secrets are available to all repositories within the organization, subject to access policies.
    • D. Correct. Repository-level secrets are specific to a single repository and are commonly used for project-specific credentials.
    • E. Correct. Environment-level secrets are restricted to specific deployment environments (e.g., production, staging) and require approval for access.
    • F. Incorrect. Step level is not a valid scope for defining secrets. Steps can only use secrets defined at higher scopes.

    Subdomain 4.3: Manage encrypted secrets and variables

    31.When managing secrets through the GitHub REST API, which of the following scopes or permissions are required for certain operations? (Choose two.)(Select 2)

    1. A.The `admin:org` scope is required to update an organization secret via API.
    2. B.The `repo` scope is necessary to retrieve a list of repository secrets.
    3. C.The `workflow` scope is needed to access secrets during workflow execution.
    4. D.The `secrets:write` permission allows creating a repository secret.
    5. E.The `user:email` scope permits decrypting a secret value from the API.
    6. F.The `public_repo` scope allows reading secrets in public repositories.
    Show answer & explanation

    Correct answers: A, BThe `admin:org` scope is required to update an organization secret via API.; The `repo` scope is necessary to retrieve a list of repository secrets.

    • A. Correct. The `admin:org` scope (or equivalent fine-grained permissions) is required to manage organization-level secrets, including updating them via the API. This scope grants administrative access to organization settings and secrets.
    • B. Correct. To list repository secrets via the REST API, the `repo` scope is required for private repositories (and `public_repo` for public repositories). Without this scope, the API call will fail.
    • C. Incorrect. The `workflow` scope is used for managing workflow files and Actions resources, but it does not grant access to secrets during workflow execution. Secrets are made available to workflows based on repository and organization settings, not via a PAT scope.
    • D. Incorrect. There is no `secrets:write` scope in the classic OAuth scopes. Creating repository secrets requires either the `repo` scope (for private repos) or appropriate fine-grained permissions.
    • E. Incorrect. The `user:email` scope only grants access to the authenticated user's email addresses and is unrelated to secrets management. The API does not allow decrypting secret values.
    • F. Incorrect. The `public_repo` scope allows access to public repositories but does not permit reading secrets. Secrets are encrypted and cannot be retrieved as plaintext via the API regardless of repository visibility.

    Domain 5: Secure and optimize automation

    Subdomain 5.1: Implement security best practices

    32.To add safeguards such as required reviewers, wait timers, and branch restrictions before jobs can deploy to an environment, you can configure a(n) __________.

    1. A.action allow list
    2. B.environment protection rule
    3. C.required status check
    Show answer & explanation

    Correct answer: Benvironment protection rule

    • A. Incorrect. An action allow list controls which GitHub Actions are permitted to run, but it is not a standard feature for protecting environments or deployments. It does not directly provide safeguards like required reviewers or branch restrictions for deployments.
    • B. Correct. An environment protection rule is used to add safeguards such as required reviewers, wait timers, and deployment branch restrictions before jobs can deploy to an environment. This directly secures deployments and is the intended answer.
    • C. Incorrect. Required status checks are used in branch protection to ensure specific checks pass before merging, but they are focused on pull request validation, not on environment-level deployment protections. They do not directly restrict which actions or workflows can access an environment.

    Subdomain 5.1: Implement security best practices

    33.Why is using a commit SHA preferred over a branch tag for secure automation workflows?

    1. A.A commit SHA provides an immutable reference to the exact code, whereas a branch tag can move to different commits.
    2. B.A branch tag is inherently more secure because it automatically fetches the latest release with patches.
    3. C.Commit SHAs are case-insensitive alphanumeric strings, making them simpler to manage than tags.
    4. D.Using a branch tag is recommended to ensure that security updates are automatically applied without changes.
    Show answer & explanation

    Correct answer: AA commit SHA provides an immutable reference to the exact code, whereas a branch tag can move to different commits.

    • A. Correct. A commit SHA is a unique, immutable identifier for a specific commit, ensuring reproducibility and security. Branch tags or branch names can move as new commits are added, making them less reliable for referencing exact code states. Therefore, commit SHAs are preferred for pinning dependencies and actions in automation and security-sensitive workflows.
    • B. Incorrect. A branch tag does not inherently provide security benefits; it can reference different commits over time, reducing predictability. Automatically fetching the latest release may introduce untested or vulnerable code. Security best practice is to pin to a specific commit SHA to know exactly what is executed.
    • C. Incorrect. Commit SHAs are hexadecimal identifiers (40-character string) and are case-sensitive. They are not simpler to manage than human-readable tags. The key property for secure automation is immutability and exact referencing, not simplicity of management.
    • D. Incorrect. Using a branch tag for automation can silently change what code runs, weakening supply-chain security. Automatically applying security updates without review is not recommended. Commit SHAs are preferred for pinning exact versions to avoid unintended changes.

    Subdomain 5.1: Implement security best practices

    34.Which of the following is the recommended way to securely pass sensitive data to workflows in GitHub Actions?

    1. A.GITHUB_TOKEN permissions
    2. B.runner specifications
    3. C.environment variables
    Show answer & explanation

    Correct answer: Cenvironment variables

    • A. Incorrect. GITHUB_TOKEN permissions control the access level of the automatically generated token for a workflow run, but they are not intended for securely storing or passing secrets. Secrets are stored separately.
    • B. Incorrect. Runner specifications define the environment where the workflow runs (OS, hardware, etc.) and do not provide a mechanism for securely passing secrets.
    • C. Correct. GitHub Secrets, which are stored as encrypted environment variables, are the recommended way to securely pass sensitive data to workflows without hardcoding them. They can be referenced in workflow files using the ${{ secrets.SECRET_NAME }} syntax.

    Subdomain 5.1: Implement security best practices

    35.Which GitHub CLI command is used to verify artifact attestations?

    1. A.gh attestation verify
    2. B.gh artifacts check
    3. C.gh verify signature
    4. D.gh provenance validate
    Show answer & explanation

    Correct answer: Agh attestation verify

    • A. Correct. `gh attestation verify` is the GitHub CLI command specifically designed to verify artifact attestations. It checks that the attestation is valid and matches the referenced artifact and predicate, ensuring the artifact's integrity and authenticity.
    • B. Incorrect. `gh artifacts check` is not a valid GitHub CLI command. GitHub provides dedicated attestation commands for verifying artifacts, not a generic artifacts check command.
    • C. Incorrect. `gh verify signature` is not a standard GitHub CLI command for attestation verification. While signature verification is related, attestation verification in GitHub CLI uses the attestation subcommand.
    • D. Incorrect. `gh provenance validate` is not the GitHub CLI command for artifact attestation verification. Provenance is a related supply-chain security concept, but the command used here is `gh attestation verify`.

    Want the full experience?

    These are just samples. Practice the full GitHub Actions Expert (GH-200) question bank in quiz mode — free, no signup, with domain practice and exam simulation.