Microsoft GitHub Actions GH-200 Exam Questions in PDF

Free Microsoft GH-200 Dumps Questions (page: 2)

In which scenarios could the GITHUB_TOKEN be used? (Choose two.)

  1. to leverage a self-hosted runner
  2. to create a repository secret
  3. to publish to GitHub Packages
  4. to create issues in the repo
  5. to read from the file system on the runner
  6. to add a member to an organization

Answer(s): C,D

Explanation:

The GITHUB_TOKEN is automatically provided by GitHub in workflows and can be used to authenticate API requests to GitHub, including publishing packages to GitHub Packages. The GITHUB_TOKEN is also used to authenticate API requests for actions like creating issues, commenting, or interacting with pull requests within the same repository.



As a developer, you need to use GitHub Actions to deploy a microservice that requires runtime access to a secure token. This token is used by a variety of other microservices managed by different teams in different repos. To minimize management overhead and ensure the token is secure, which mechanisms should you use to store and access the token? (Choose two.)

  1. Store the token in a configuration file in a private repository. Use GitHub Actions to deploy the configuration file to the runtime environment.
  2. Store the token as a GitHub encrypted secret in the same repo as the code. Create a reusable custom GitHub Action to access the token by the microservice at runtime.
  3. Use a corporate non-GitHub secret store (e.g., HashiCorp Vault) to store the token. During deployment, use GitHub Actions to store the secret in an environment variable that can be accessed at runtime.
  4. Store the token as a GitHub encrypted secret in the same repo as the code. During deployment, use GitHub Actions to store the secret in an environment variable that can be accessed at runtime.
  5. Store the token as an organizational-level encrypted secret in GitHub. During deployment, use GitHub Actions to store the secret in an environment variable that can be accessed at runtime.

Answer(s): C,E

Explanation:

Using a corporate secret store like HashiCorp Vault provides a secure, centralized location for sensitive information. GitHub Actions can then retrieve and store the token securely during deployment by setting it as an environment variable, ensuring the token remains secure and accessible at runtime.

Storing the token as an organizational-level encrypted secret in GitHub ensures it is accessible across multiple repositories, minimizing management overhead. GitHub Actions can then use this secret during deployment by setting it as an environment variable, allowing the microservice to access it securely at runtime.



What is the minimal syntax for declaring an output named foo for an action?
A)



B)



C)



D)

  1. Option A
  2. Option B
  3. Option C
  4. Option D

Answer(s): C

Explanation:

The correct minimal syntax for declaring an output in GitHub Actions is by using the foo key under outputs, and associating it with a value (in this case, Some value). This is the simplest form to define an output in a workflow or action.



When reviewing an action for use, what file defines its available inputs and outputs?

  1. inputs.yml
  2. config.json
  3. defaults.json
  4. workflow.yml
  5. action.yml

Answer(s): E

Explanation:

The action.yml file defines the inputs and outputs for a GitHub Action. This file contains metadata about the action, including the required inputs and outputs, as well as other configurations like the action's description, runs, and environment setup.



How should you install the bats NPM package in your workflow? A)



B)



C)



D)

  1. Option A
  2. Option B
  3. Option C
  4. Option D

Answer(s): D

Explanation:

The correct syntax includes specifying the job (example-job), the runner (ubuntu-latest), and the necessary step (npm install -g bats) within the workflow. This ensures that the package is installed properly during the execution of the job.



How can GitHub Actions encrypted secrets be used in if: conditionals within a workflow job?

  1. Set the encrypted secret as a job-level environment variable and then reference the environment variable within the conditional statement.
  2. Create a job dependency that exposes the encrypted secret as a job output, which can then be leveraged in a subsequent dependent job.
  3. Use the secrets context within the conditional statement, e.g. ${{ secrets.MySuperSecret }}.
  4. Use a workflow command to expose the encrypted secret via a step's output parameter and then use the step output in the job's if: conditional.

Answer(s): C

Explanation:

GitHub Actions encrypted secrets can be accessed in workflows using the secrets context. You can directly reference the secret within an if: conditional using ${{ secrets.MySuperSecret }} to determine whether a job or step should run based on the secret's value.



As a DevOps engineer, you are developing a container action. You need to execute a cleanup script after completing the main script execution.
Which code block should be used to define the cleanup script?





Answer(s): A

Explanation:

The correct syntax for specifying a cleanup script to be run after the main entry point is executed in a Docker-based GitHub Action is to use the post key. This ensures that cleanup.sh runs after the main script (main.sh) has completed.



Which default GitHub environment variable indicates the name of the person or app that initiated a workflow?

  1. ENV_ACTOR
  2. GITHUB_WORKFLOW_ACTOR
  3. GITHUB_ACTOR
  4. GITHUB_USER

Answer(s): C

Explanation:

The GITHUB_ACTOR environment variable indicates the name of the person or app that initiated the workflow. This variable is automatically provided by GitHub in the workflow and can be used to identify the user or application triggering the workflow.



Share your comments for Microsoft GH-200 exam with other users:

A
AI Tutor Explanation
5/10/2026 12:51:57 AM

Which statement is true about using default environment variables? The environment variables can be read in workflows using the ENV: variable_name syntax. The environment variables created should be prefixed with GITHUB_ to ensure they can be accessed in workflows The environment variables can be set in the defaults: sections of the workflow The GITHUB_WORKSPACE environment variable should be used to access files from within the runner.
Correct answer: The statement "The GITHUB_WORKSPACE environment variable should be used to access files from within the runner." is true.
Why the others are false:

  • ENV: variable_name syntax is not how you read env vars in workflows. Use ${{ env.VARIABLE }} in expressions or $VARIABLE in a shell.
  • Environment variables don’t need a GITHUB_ prefix. Custom vars can have any name; GITHUB_ is only for built-in, predefined vars.
  • defaults: cannot set environment variables. It configures defaults for run steps (like shell or working-directory), not env vars.

Extra tip:
  • GITHUB_WORKSPACE (or ${{ github.workspace }}) is the root path on the runner where the repository is checked out. Use it to access files, e.g., $GITHUB_WORKSPACE/... or ${{ github.workspace }}/....

AI Tutor 👋 I’m here to help!