Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free Microsoft GitHub Actions Exam GH-200 Exam Questions

Last updated: · 10 practice questions with answers and explanations

Page: 1 / 12 Total 113 questions

Want more questions? Get Premium Access.

Question 1

New Multiple answers

Topic: Author and manage workflows

Skill tested: Configures workflow inputs and permissions for reusable, manually dispatched workflows.

A release engineering team uses a manually dispatched workflow to deploy a selected service to a specified environment. The workflow is called by another workflow in the same repository, and the caller must supply both values. The deployment job needs to update a deployment status but must not receive unnecessary repository write access. The team also wants the workflow's manually supplied inputs to be typed and validated by GitHub. Which TWO changes meet these requirements? Select TWO.

Correct Answer: B. Set the deployment job's `permissions` to the minimum required, including `deployments: write` and only other required scopes.; C. Declare the values under `on.workflow_dispatch.inputs` with appropriate types, and declare corresponding inputs under `on.workflow_call.inputs`.
Explanation:

A reusable workflow can expose inputs through `on.workflow_call.inputs`, while manual dispatch inputs are separately declared under `on.workflow_dispatch.inputs`; corresponding declarations are needed for both invocation methods. GitHub validates declared input types for these events. The deployment status operation should receive only the required token scope, such as `deployments: write`, with other permissions kept minimal. Repository variables are not a substitute for typed workflow inputs, `write-all` is unnecessarily broad, and `workflow_run` does not provide this typed reusable-workflow input interface.

Question 2

New Single answer

Topic: Author and manage workflows

Skill tested: Passes step and job outputs safely using GITHUB_OUTPUT and needs contexts.

A build workflow runs a version-discovery step and then starts a separate packaging job. The packaging job must use the discovered version in its artifact name. The value is generated during the run and cannot be known when the workflow is parsed. The team currently writes `VERSION=...` to `GITHUB_ENV` and expects another job to read it through the `env` context, but that value is unavailable there. What is the best correction?

Correct Answer: C. Write the version to `GITHUB_OUTPUT`, expose the step output as a build-job output, and reference it through `needs` in the packaging job.
Explanation:

`GITHUB_ENV` makes a value available to later steps in the same job; it does not transfer the value to another job. A step writes a named output to `GITHUB_OUTPUT`, the job maps that step output under `jobs..outputs`, and a dependent job reads it using `needs..outputs.`. `GITHUB_PATH` adds executable search paths, not general data. Workflow-level environment values are evaluated before the runtime step has produced its output, so they cannot serve as this dynamic cross-job channel.

Question 3

New Single answer

Topic: Author and manage workflows

Skill tested: Designs matrix jobs and conditional execution without duplicating workflow logic.

A team tests a library against three operating systems and two runtime versions. One combination, the oldest runtime on the newest operating system, is unsupported. The other five combinations should run as independent matrix jobs, and the team wants one workflow definition rather than hand-written jobs. Which configuration is the most appropriate?

Correct Answer: D. Define `strategy.matrix` with the OS and runtime arrays, then use `exclude` to remove the unsupported pair.
Explanation:

A matrix expands the Cartesian product of the configured dimensions into independent jobs. An `exclude` entry removes the specific unsupported operating-system/runtime pair while retaining the other five combinations. Explicit jobs can work but duplicate configuration and do not meet the maintainability requirement. Selecting a runtime from the runner name is brittle and fails to model the intended combinations. `fail-fast: false` affects cancellation behavior after failures; it does not filter matrix combinations.

Question 4

New Single answer

Topic: Consume and troubleshoot workflows

Skill tested: Interprets matrix run results and selectively reruns failed workflow jobs.

A release workflow expands a test matrix across four operating systems and three runtime versions. Two combinations fail intermittently, while the other ten complete successfully. A developer wants to inspect the failed combinations' logs and rerun only those jobs without restarting successful work. Which approach best meets the requirement?

Correct Answer: C. Open the workflow run, inspect the failed matrix jobs and their logs, then use the run's rerun-failed-jobs option.
Explanation:

The workflow run page presents the expanded matrix jobs and provides access to each job's logs. GitHub's rerun-failed-jobs operation reruns failed and dependent jobs rather than needlessly restarting successful independent jobs. A new run is a separate execution and does not automatically reuse completed jobs. Artifacts are uploaded files, not a replacement for job logs or a rerun mechanism. The run API does not edit a completed run's matrix configuration.

Question 5

New Multiple answers

Topic: Author and maintain actions

Skill tested: Validates JavaScript action metadata, runtime dependencies, and execution entry points.

A repository contains a JavaScript action under `actions/report`. It works when its script is invoked directly in a developer shell, but a workflow fails when referencing `./actions/report`. The directory has `report.js` and `package.json`, but no action metadata file. The action must run on GitHub-hosted Linux runners and accept a required `format` input. Which TWO changes are necessary for it to be consumed as a JavaScript action? Select TWO.

Correct Answer: A. Add an `action.yml` file defining the action's `name`, required `format` input, and JavaScript `runs` configuration with `using` and `main`.; C. Ensure the JavaScript entry point and required dependencies are available in the checked-out action directory, and identify the entry point in the metadata.
Explanation:

A JavaScript action requires action metadata, conventionally `action.yml` or `action.yaml`, that defines its inputs and `runs` configuration, including the JavaScript runtime and entry point. The entry point and any required dependencies must be present and usable when the action runs; direct shell execution alone does not make a directory a GitHub Action. A Dockerfile and `runs.using: docker` describe a different action implementation. `package.json` does not replace action metadata, and workflow files are not action definitions.

Question 6

New Single answer

Topic: Author and maintain actions

Skill tested: Diagnoses composite action steps, input expressions, and metadata requirements.

An automation team packages several shell commands as a composite action. The action metadata declares an input named `target`, but a workflow run reports that the action's first step received an empty value. The step uses `run: ./deploy.sh ${{ inputs.target }}` and the action is referenced from a local repository path. The team wants to keep the implementation composite and avoid changing the caller's interface. What should it verify first in the action definition?

Correct Answer: B. That `runs.using` is set to `composite` and each `run` step declares a valid `shell`.
Explanation:

Composite action metadata must identify `runs.using: composite`, and each command step must specify its shell. The action can then reference its input through the `inputs` context in its steps, provided the metadata declares that input and the caller supplies it. Broad token permissions do not populate an input. `node20` and `main` describe a JavaScript action, not a composite action. Changing the input to an output would reverse the intended data direction.

Question 7

New Multiple answers

Topic: Manage GitHub Actions for the enterprise

Skill tested: Controls runner access through runner groups and organization-level workflow policies.

A company has organization-owned self-hosted runners that can reach an internal deployment network. Only the production deployment repository should be able to use them. Organization administrators also need to prevent unapproved actions from running across repositories, while allowing a reviewed set of actions. The runners must remain available to a separate CI repository that uses GitHub-hosted runners. Which TWO controls best satisfy these requirements? Select TWO.

Correct Answer: A. Place the self-hosted runners in a runner group and restrict that group's repository access to the production deployment repository.; C. Configure the organization Actions policy to allow only the approved actions and set the permitted actions or patterns accordingly.
Explanation:

Runner groups provide an access boundary for self-hosted runners, including restricting which repositories can use the group; labels help select compatible runners but are not an access-control substitute. An organization Actions policy can restrict which actions workflows are permitted to use while allowing reviewed actions or patterns. Disabling Actions broadly conflicts with the required CI use and is not a targeted control. Organization variables are not a secure place for credentials and broad availability would violate least privilege.

Question 8

New Single answer

Topic: Manage GitHub Actions for the enterprise

Skill tested: Selects runner operating environments based on workload and hosted-runner capabilities.

A data engineering group needs to run a large, memory-intensive test suite. The workload requires more memory than the standard GitHub-hosted runner available to the repository, but it does not need access to private network resources or persistent local state. The group wants GitHub to provision and maintain the compute rather than operate machines itself. Which runner approach best fits these constraints?

Correct Answer: B. Use a larger GitHub-hosted runner configuration that provides the required compute capacity.
Explanation:

A larger GitHub-hosted runner is the appropriate managed option when a job needs greater compute capacity but does not require private network access or persistent machine control. Increasing `timeout-minutes` changes the allowed duration, not the runner's memory. Self-hosted runners are an option when particular hardware or network control is required, but they add operational responsibility that the team explicitly wants to avoid. A service container supplies a service environment; it does not expand the runner's allocated memory.

Question 9

New Multiple answers

Topic: Secure and optimize automation

Skill tested: Applies environment protection rules and narrowly scoped workflow token permissions.

A repository deploys production software from a protected branch. A production deployment must wait for an authorized reviewer, and its cloud deployment identity must not be exposed to pull-request workflows. The deployment job needs to obtain a short-lived cloud credential through OIDC and update a GitHub deployment record. Which TWO configuration choices best meet the requirements? Select TWO.

Correct Answer: C. Attach the deployment job to a protected `production` environment with required reviewers, and make the cloud role trust the expected repository and environment identity claims.; D. Grant the deployment job `id-token: write` and only the necessary `deployments: write` permission, leaving unrelated token permissions disabled.
Explanation:

Environment protection rules can require approval before a production deployment proceeds, and an OIDC trust policy should constrain which repository and environment identity can assume the cloud role. The workflow needs `id-token: write` to request an OIDC token and only the necessary GitHub token permissions, including `deployments: write` for deployment records. Long-lived keys should not be broadly exposed, `write-all` violates least privilege, and `pull_request_target` is not a safe method for granting untrusted pull-request code production credentials.

Question 10

New Single answer

Topic: Secure and optimize automation

Skill tested: Pins third-party actions to immutable commit SHAs to reduce supply-chain risk.

A security review finds that several workflows reference third-party actions using mutable version tags, such as `uses: vendor/tool@v3`. The organization wants to reduce the chance that an upstream tag change alters workflow behavior without review. It also wants updates to remain deliberate and auditable. Which change most directly addresses this risk?

Correct Answer: D. Pin each third-party action reference to a verified full commit SHA and update that SHA through the organization's normal review process.
Explanation:

A full commit SHA identifies an immutable revision, so a maintainer moving a tag cannot silently change the code executed by the workflow. Updating the pinned SHA through review provides a deliberate and auditable update path. Version tags, including major-version tags, are mutable references and therefore do not provide the same immutability guarantee. A workflow display name has no effect on action-source validation, and branches are also mutable.