Microsoft GitHub Actions GH-200 Dumps in PDF

Free Microsoft GH-200 Real Questions (page: 1)

How should you print a debug message in your workflow?

  1. echo "::debug::Set variable myVariable to true"
  2. echo "Set variable MyVariable to true" >> $DEBUG_MESSAGE
  3. echo "::add-mask::Set variable myVariable to true"
  4. echo "debug_message=Set variable myVariable to true" >> &GITHUB_OUTPUT

Answer(s): A

Explanation:

Example: Setting a debug message echo "::debug::Set the Octocat variable"


Reference:

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands



As a developer, you are designing a workflow and need to communicate with the runner machine to set environment variables, output values used by other actions, add debug messages to the output logs, and other tasks.
Which of the following options should you use?

  1. composite run step
  2. enable debug logging
  3. self-hosted runners
  4. environment variables
  5. workflow commands

Answer(s): E

Explanation:

Workflow commands for GitHub Actions
You can use workflow commands when running shell commands in a workflow or in an action's code.
About workflow commands
Actions can communicate with the runner machine to set environment variables, output values used by other actions, add debug messages to the output logs, and other tasks.
Most workflow commands use the echo command in a specific format, while others are invoked by writing to a file.


Reference:

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands



When should you use the GITHUB_TOKEN in a workflow?

  1. when you want to make authenticated calls to the GitHub API
  2. when you want to connect to the runner via SSH
  3. when you want to access repository-level secrets
  4. when you want to call an action from the marketplace

Answer(s): A

Explanation:

Use GITHUB_TOKEN for authentication in workflows
At the start of each workflow job, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow. You can use the GITHUB_TOKEN to authenticate in the workflow job.


Reference:

https://docs.github.com/en/actions/tutorials/authenticate-with-github_token



In which of the following scenarios should you use self-hosted runners? (Each correct answer presents a complete solution. Choose two.)

  1. when the workflow jobs must be run on Windows 10
  2. when jobs must run for longer than 6 hours
  3. when a workflow job needs to install software from the local network
  4. when GitHub Actions minutes must be used for the workflow runs
  5. when you want to use macOS runners

Answer(s): B,C

Explanation:

[B] You can use self-hosted runner to run more than 6 hours job.
Self-hosted runners give you the opportunity to persist whatever you like for your jobs and not be subject to the six-hour time-out in hosted virtual environments.
[C] Give you more control of hardware, operating system, and software tools than GitHub-hosted runners provide.
All runners can run Linux, Windows, or macOS.
Incorrect:
[Not A, not E]
GitHub-hosted runners are fully managed on GitHub’s infrastructure using pre-configured Windows, Linux, and macOS virtual machines. In addition to offering standard runners for typical workloads, hosted runners offer larger runners with more resources (memory, CPU, and storage), custom images, static IP ranges, and Azure Virtual Network integration for enhanced security control.
[Not D]
GitHub Actions minutes refer to the amount of time your workflows, such as CI/CD pipelines, run on GitHub's hosted runners. Each time you trigger GitHub Actions (e.g., for testing, building, or deploying code), it consumes a portion of your available minutes.5 Dec 2024


Reference:

https://github.com/orgs/community/discussions/26679
https://docs.github.com/en/enterprise-cloud@latest/admin/managing-github-actions-for-your-enterprise/getting-started-with-github-actions-for-your-enterprise/getting-started-with-self-hosted-runners-for-your-enterprise https://docs.github.com/en/enterprise-cloud@latest/actions/concepts/runners/self-hosted-runners



As a developer, you need to leverage Redis in your workflow.
What is the best way to use Redis on a self-hosted Linux runner without affecting future workflow runs?

  1. Install Redis on the hosted runner image and place it in a runner group. Specify label: in your job to target the runner group.
  2. Set up Redis on a separate machine and reference that instance from your job.
  3. Specify container: and services: in your job definition to leverage a Redis service container.
  4. Add a run step to your workflow, which dynamically installs and configures Redis as part of your job.

Answer(s): C

Explanation:

Creating Redis service containers
You can use service containers to create a Redis client in your workflow. You can create a Redis service for jobs that run in containers or directly on the runner machine.
Configuring the runner job
The example uses the ubuntu-latest GitHub-hosted runner as the Docker host.
The workflow configures a service container with the label redis.
jobs:
# Label of the runner job runner-job:
# You must use a Linux environment when using service containers or container jobs runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container redis:
# Docker Hub image image: redis
# Set health checks to wait until redis has started options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379


Reference:

https://docs.github.com/en/actions/tutorials/use-containerized-services/create-redis-service-containers



As a developer, you want to review the step that caused a workflow failure and the failed step's build logs, First navigate to the main page of the repository on GitHub, Which section contains the step failure information?

  1. Code
  2. Issues
  3. Actions
  4. Insights
  5. Pull requests

Answer(s): C

Explanation:

To view a failed step and its build logs in GitHub Actions, you must navigate to the Actions section of your repository.
The Actions tab is the dedicated space in any GitHub repository for managing, viewing, and debugging automated workflows. Clicking this tab allows you to see the history of all workflow runs, select the specific failed run, drill down into individual jobs, and expand the precise step that caused the error to read its execution logs.


Reference:

https://blog.devgenius.io/devops-beginners-project-3-build-a-python-ci-cd-pipeline-with-github-actions-677635 9e096b



By default, which workflows can use an action stored in internal repository? (Each answer presents a complete solution. Choose two.)

  1. selected public repositories outside of the enterprise
  2. internal repositories owned by the same organization as the enterprise
  3. public repositories owned by the same organization as the enterprise
  4. private repositories owned by an organization of the enterprise

Answer(s): B,D

Explanation:

Any actions or reusable workflows stored in the internal or private repository can be used in workflows defined in other internal or private repositories owned by the same organization, or by any organization owned by the enterprise.


Reference:

https://docs.github.com/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise



You have a GitHub Actions workflow YAML file that contains the following lines.

Which two statements accurately describe the behavior of the workflow? Each correct answer presents a complete solution.
Note: Each correct selection is worth one point.

  1. The workflow will publish a package to GitHub Packages.
  2. The workflow will publish a package to a Node Package Manager (npm) registry.
  3. The publish-npm workflow job will run only after the build job passes.
  4. The file is using a matrix strategy.

Answer(s): B,C

Explanation:

[C]
By using the needs keyword, you create a sequential dependency. If the build job fails or is skipped, the publish-npm job will not run by default.
In a GitHub Actions workflow, a job with the needs keyword will run only if the jobs it needs complete successfully or are skipped without an error. By default, if a dependency fails, the dependent job (in this case, publish-npm) is automatically skipped.
To make the publish-npm job run even if the build job fails, you must use a conditional expression, such as if: always() or if: success() || failure().
[B, not A]
We see in the last line of code that an NPM token is used for authentication-
Note:
When publishing a Node.js package using GitHub Actions, the primary differences between using the npm registry and GitHub Packages involve authentication methods, registry configuration, and package naming requirements.
Key Differences at a Glance
*-> Authentication .
For npm Registry
Requires a manually created npm token stored as a secret
For GitHub Packages
Can use the built-in GITHUB_TOKEN automatically provided by GitHub.


Reference:

https://blog.anoff.io/2020-07-private-npm-package-github https://dev.to/gervaisamoah/introduction-to-github-actions-easy-guide-3p23



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!