Halloween Sale Special - 75% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 75only

Microsoft GH-200 GitHub Actions Exam Exam Practice Test

Demo: 41 questions
Total 137 questions

GitHub Actions Exam Questions and Answers

Question 1

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?

Options:

A.

Add a run step to your workflow, which dynamically installs and configures Redis as part of your job.

B.

Specify container: and services: in your job definition to leverage a Redis service container.

C.

Set up Redis on a separate machine and reference that instance from your job.

D.

Install Redis on the hosted runner image and place it in a runner group. Specify label: in your job to target the runner group.

Question 2

When creating and managing custom actions in an enterprise setting, which of the following is considered a best practice?

Options:

A.

creating a separate repository for each action so that the version can be managed independently

B.

creating a separate branch in application repositories that only contains the actions

C.

creating a single repository for all custom actions so that the versions for each action are all the same

D.

including custom actions that other teams need to reference in the same repository as application code

Question 3

As a developer, you are authoring a workflow that will deploy to both DevCloud and TestCloud resources. Each cloud resource is accessed with a different deployment key. Which approach best allows you to use the same reusable workflow in separate jobs to target the different cloud resources?

Options:

A.

Create repository secrets named DevCloud.DEPLOY_KEY and TestCloud.DEPLOY_KEY so that the reusable workflow parses the secrets by resource name.

B.

Store the different keys in a DEPLOY_KEY environment secret in the DevCloud and TestCloud environments. Specify DEPLOY_KEY in the secrets section of the reusable workflow.

C.

Use a marketplace action to conditionally parse the DEPLOY_KEY repository secret based on the cloud resource name.

D.

Populate a DEPLOY_KEY repository secret with a JSON object containing DevCloud and TestCloud properties. Then specify DEPLOY_KEY.DevCloud in the secrets sections of the reusable workflow.

Question 4

Which default environment variable specifies the branch or tag that triggered a workflow?

Options:

A.

GITHUB_TAG

B.

GITHUB_REF

C.

ENV_BRANCH

D.

GITHUB_BRANCH

Question 5

While writing a custom action, some behavior within the runner must be changed. Which workflow commands would set an error message in the runner ' s output?

(Each correct answer presents a complete solution. Choose two.)

Options:

A.

echo " ::error message=There was an error:: "

B.

echo " ::error::There was an error "

C.

echo " ::error file=main.py,line=10,col=15::There was an error "

D.

echo " ::error=There was an error:: "

Question 6

You need to create a reusable GitHub Actions workflow template named ci.yml. The solution must ensure that ci.yml appears on the New workflow interface of GitHub Actions. Where should you store ci.yml?

Options:

A.

.github/workflows

B.

.github/templates

C.

.github/workflow-templates

D.

the root directory of each repository

Question 7

Which workflows can use an action stored in an internal repository when repository access is enabled for the organization or enterprise?

(Each correct answer presents a complete solution. Choose two.)

Options:

A.

Workflows in internal repositories owned by the same organization or enterprise.

B.

Workflows in private repositories owned by an organization in the enterprise.

C.

Workflows in selected public repositories outside the enterprise.

D.

Workflows in public repositories owned by the same organization as the enterprise.

Question 8

What is the simplest action type to run a shell script?

Options:

A.

Docker container action

B.

Composite action

C.

Bash script action

D.

JavaScript action

Question 9

As a developer, one of your workflows requires Xcode version 11.2 hosted on macOS Catalina (version 10.15). You have already created and configured a self-hosted runner to conform to those requirements and registered it with your organization. What else should you do to ensure that the workflow accesses the correct runner instance?

(Each correct answer presents part of the solution. Choose three.)

Options:

A.

Create runner groups named macos-10.15 and xcode-11.2.

B.

In the workflow, specify:

runs-on: [${{ groups.macos-10.15 }}, ${{ groups.xcode-11.2 }}]

C.

Assign the custom labels to the self-hosted runner.

D.

Create custom runner labels for macos-10.15 and xcode-11.2.

E.

Add your runner to the appropriate runner groups.

F.

In the workflow, specify:

runs-on: [self-hosted, macos-10.15, xcode-11.2]

Question 10

As a developer, which workflow steps should you perform to publish an image to the GitHub Container Registry? (Choose three.)

Options:

A.

Use the actions/setup-docker action

B.

Authenticate to the GitHub Container Registry.

C.

Build the container image.

D.

Push the image to the GitHub Container Registry

E.

Pull the image from the GitHub Container Registry.

Question 11

You need to create new workflows to deploy to an unfamiliar cloud provider. What is the fastest and safest way to begin?

Options:

A.

Create a custom action to wrap the cloud provider ' s CLI.

B.

Search GitHub Marketplace for verified actions published by the cloud provider.

C.

Use the actions/jenkins-plugin action to utilize an existing Jenkins plugin for the cloud provider.

D.

Search GitHub Marketplace for actions created by GitHub.

E.

Download the CLI for the cloud provider and review the associated documentation.

Question 12

A single secret must be accessed by workflows in specific repositories. What is the best way to create the secret?

Options:

A.

Create an organization secret, specify Selected repositories as the repository access, and select the required repositories.

B.

Create an environment secret at the organization level and leverage that environment in each of the specified repositories.

C.

Store the secret in a supported external key vault. Configure OpenID Connect (OIDC) to allow access to the external vault and link the secret from the external key vault in each of the specific repositories.

D.

Create the secret in one of the repositories, check the Share secret option, and select the required repositories.

Question 13

Which workflow event is used to manually trigger a workflow run?

Options:

A.

create

B.

workflow_dispatch

C.

workflow_run

D.

status

Question 14

Your organization has a secret that must be available to all the repositories within GitHub Actions workflows.

You need to store the secret. The solution must minimize administrative effort.

What should you do in GitHub?

Options:

A.

For each GitHub repository, select Settings > Secrets and variables > Actions, and then add the secret.

B.

From your personal GitHub profile, select Settings > Developer settings > Secrets, and then add the secret.

C.

From the organization ' s page, select Settings > Security > Secrets, and then add the secret.

D.

From the organization ' s page, select Settings > Secrets and variables > Actions, and then add the secret.

Question 15

As a developer, you need to create a custom action written in Python. Which action type should you choose?

Options:

A.

Python action

B.

JavaScript action

C.

Docker container action

D.

Composite run step

Question 16

Which step is using the dbserver environment variable correctly?

Options:

A.

steps:

- name: Hello world

run: echo $dbserver

variables:

dbserver: orgserver1

B.

steps:

- name: Hello world

run: echo $dbserver

env:

dbserver: orgserver1

C.

steps:

- name: Hello world

run: echo $dbserver

env:

- name: dbserver

value: orgserver1

D.

steps:

- name: Hello world

run: echo $dbserver

environment:

dbserver: orgserver1

Question 17

Which run: command will set a step ' s output?

Options:

A.

run: echo " MY_OUTPUT=foo " > > $GITHUB_OUTPUT

B.

run: export MY_OUTPUT=foo

C.

run: echo ${{ $GITHUB_OUTPUT=foo }}

D.

run: echo " ::set-env name=MY OUTPUT::foo "

Question 18

You need to use a specific version of an action. How should you use v1 of an actions/javascript-action repository in your workflow?

Options:

A.

steps:uses: actions/javascript-action/v1

B.

steps:uses: actions/javascript-actionversion: v1

C.

steps:uses: actions/javascript-action-v1

D.

steps:uses: actions/javascript-action@v1

Question 19

What menu options in a repository do you need to select in order to use a starter workflow that is provided by your organization?

Options:

A.

Actions > Load workflow

B.

Workflow > New workflow

C.

Workflow > Load workflow

D.

Actions > New workflow

Question 20

As a DevOps engineer, you are developing workflows to build an application. You have a requirement to create the build targeting multiple node versions. Which code block should you use to define the workflow?

Options:

A.

jobs:build-app:strategy:matrix:node-ver: [10, 12, 14]steps:- uses: actions/setup-node@v3with:node-version: ${{ strategy.node-ver }}

B.

jobs:build-app:strategy:matrix:node-ver: [10, 12, 14]steps:- uses: actions/setup-node@v3with:node-version: ${{ matrix.node-ver }}

C.

jobs:build-app:matrix-strategy:node-ver: [10, 12, 14]steps:- uses: actions/setup-node@v3with:node-version: ${{ matrix-strategy.node-ver }}

D.

jobs:build-app:matrix:strategy:node-ver: [10, 12, 14]steps:- uses: actions/setup-node@v3with:node-version: ${{ matrix.node-ver }}

Question 21

What is the most secure way to store sensitive information in GitHub Actions workflows?

Options:

A.

Use environment variables in the workflow and store sensitive data directly in the variables.

B.

From the GitHub repository settings, store sensitive data as unencrypted text.

C.

Store the sensitive information as plain text in the workflow YAML file.

D.

Use GitHub Enterprise Managed User (OIDC) integration to dynamically fetch secrets from a third-party secrets manager.

Question 22

As a DevOps engineer, you are developing a composite action. You have a step that needs to be executed against a subdirectory. Which code snippet should you use within the composite action to specify the directory?

Options:

A.

runs:using: " composite " steps:- run: $GITHUB_ACTION_PATH/script.shdirectory: ${{ inputs.dir }}shell: bash

B.

runs:using: " composite " directory: ${{ inputs.dir }}steps:- run: $GITHUB_ACTION_PATH/script.shshell: bash

C.

runs:using: " composite " working-directory: ${{ inputs.dir }}steps:- run: $GITHUB_ACTION_PATH/script.shshell: bash

D.

runs:using: " composite " steps:- run: $GITHUB_ACTION_PATH/script.shworking-directory: ${{ inputs.dir }}shell: bash

Question 23

As a developer, what options should you recommend to implement standards for automation reuse? (Choose two.)

Options:

A.

Create workflow templates and store them in the organization ' s .github repository.

B.

Create reusable actions and workflows that can be called from other workflows.

C.

Create a marketplace partition to publish reusable automation for the company.

D.

Store shared corporate actions in subfolders in a defined and documented internally accessible repository.

Question 24

As a developer, your Actions workflow often reuses the same outputs or downloaded dependencies from one run to another. To cache dependencies for a job, you are using the GitHub cache action. Which input parameters are required for this action? (Choose two.)

Options:

A.

dependency: the name and version of a package to cache or restore

B.

key: the key created when saving a cache and the key used to search for a cache

C.

cache-hit: the copy action key used with restore parameter to restore the data from the cache

D.

path: the file path on the runner to cache or restore

E.

ref: the ref name of the branch to access and restore a cache created

F.

restore-keys: the copy action key used with cache parameter to cache the data

Question 25

GitHub-hosted runners support which capabilities? (Choose two.)

Options:

A.

automatic patching of both the runner and the underlying OS

B.

automatic file-system caching between workflow runs

C.

support for Linux, Windows, and mac

D.

support for a variety of Linux variations including CentOS, Fedora, and Debian

E.

requiring a payment mechanism (e.g., credit card) to use for private repositories

Question 26

What can be used to set a failed status of an action from its code?

Options:

A.

@actions/github toolkit

B.

JavaScript dist/ folder

C.

Dockerfile CMD

D.

a non-zero exit code

E.

output variable

F.

composite run step

Question 27

Which statement is true about using default environment variables?

Options:

A.

The environment variables can be read in workflows using the ENV: variable_name syntax.

B.

The environment variables created should be prefixed with GITHUB_ to ensure they can be accessed in workflows

C.

The environment variables can be set in the defaults: sections of the workflow

D.

The GITHUB_WORKSPACE environment variable should be used to access files from within the runner.

Question 28

When should you use the GITHUB_TOKEN in a workflow?

Options:

A.

When you want to make authenticated calls to the GitHub API.

B.

When you want to connect to the runner via SSH.

C.

When you want to access repository-level secrets.

D.

When you want to call an action from GitHub Marketplace.

Question 29

As a DevOps engineer, you are trying to leverage an organization secret in a repo. The value received in the workflow is not the same as that set in the secret. What is the most likely reason for the difference?

Options:

A.

There is a different value specified at the rego level.

B.

There is a different value specified at the workflow level.

C.

The Codespace secret doesn ' t match the expected value.

D.

The Encrypt Secret setting was not configured for the secret.

E.

There is a different value specified at the enterprise level.

Question 30

As a developer, you need to integrate a GitHub Actions workflow with a third-party code quality provider that uses the Checks API. How should you trigger a follow-up workflow?

Options:

A.

Add the workflow_run webhook event as a trigger for the workflow for the code quality integration name

B.

Add the check_run webhook event as a trigger for the workflow when the code quality integration is completed

C.

Add the pull_request webhook event as a trigger for the workflow when the code quality integration is synchronized

D.

Add the deployment webhook event as a trigger for the workflow when the code quality integration is completed

Question 31

You need to make a script to retrieve workflow run logs by using the API. Which is the correct API endpoint to download a workflow run log?

Options:

A.

GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs

B.

POST /repos/{owner}/{repo}/actions/runs/{run_id}/logs

C.

GET /repos/{owner}/{repo}/actions/artifacts/logs

D.

POST /repos/{owner}/{repo}/actions/runs/{run_id}

Question 32

Disabling a workflow allows you to stop a workflow from being triggered without having to delete the file from the repo. In which scenarios would temporarily disabling a workflow be most useful? (Choose two.)

Options:

A.

A workflow sends requests to a service that is down.

B.

A workflow error produces too many, or wrong, requests, impacting external services negatively.

C.

A workflow is configured to run on self-hosted runners

D.

A workflow needs to be changed from running on a schedule to a manual trigger

E.

A runner needs to have diagnostic logging enabled.

Question 33

Which statement accurately describes using labels to route GitHub Actions workflows to runners?

Options:

A.

A user can assign multiple labels to a self-hosted runner and use the labels in a runs-on to target only runners that match all the specified labels.

B.

Labels apply only to GitHub-hosted runners and are ignored by self-hosted runners.

C.

GitHub Actions automatically assigns the runner’s IP address as a label, and the label must be used in a runs-on.

D.

To target a specific runner, the runs-on must match the runner’s hostname rather than its labels.

Question 34

In which locations can actions be referenced by workflows? (Choose three.)

Options:

A.

a separate public repository

B.

an .action extension file in the repository

C.

the same repository as the workflow

D.

a published Docker container image on Docker Hub

E.

the runs-on: keyword of a workflow file

F.

the repository ' s Secrets settings page

G.

a public NPM registry

Question 35

As a DevOps engineer, you need to execute a deployment to different environments like development and testing based on the labels added to a pull request. The deployment should use the releases branch and trigger only when there is a change in the files under apps folder. Which code block should be used to define the deployment workflow trigger?

Options:

A.

on:pull_request_label:branches:- ' releases ' paths:- ' apps/** '

B.

on:pull_request_review:types: [labeled]branches:- ' releases ' paths:- ' apps/** '

C.

on:pull_request:types: [labeled]branches:- ' releases/** ' paths:- ' apps '

D.

on:pull_request:types: [labeled]branches:- ' releases ' paths:- ' apps/** '

Question 36

What are the most significant advantages of adding documentation while distributing custom actions?

(Each answer presents a complete solution. Choose two.)

Options:

A.

It shares the description of the action with users.

B.

It creates a README.md for the consuming workflow.

C.

It provides an example of the action.

D.

It generates autocomplete when using the action in a workflow.

Question 37

A workflow that had been working now stalls in a waiting state until failing. The workflow file process_ml.yaml has not changed and contains jobs specifying runs-on: [gpu]. Which of the following steps would troubleshoot the issue?

(Each answer presents a complete solution. Choose two.)

Options:

A.

Review the contents of the Runner_*.log files in the _diag folder.

B.

Rotate the GITHUB_TOKEN secret for the appropriate runners.

C.

Check the Set up job step in the logs of the last successful run to determine the runner.

D.

Update the organization settings to enable GPU-based GitHub-hosted runners.

E.

Increase the usage limits for GitHub-hosted runners.

Question 38

What is the proper syntax to reference the system-provided run number variable?

Options:

A.

$GITHUB_RUN_NUMBER

B.

${{ env.GITHUB_RUN_NUMBER }}

C.

${{ var.GITHUB_RUN_NUMBER }}

D.

$github.run_number

E.

${{ GITHUB_RUN_NUMBER }}

Question 39

As a developer, which of the following snippets will enable you to run the commands npm ci and npm run build as part of a workflow?

Options:

A.

- run: |

npm ci

npm run build

B.

- shell:

npm ci

npm run build

C.

- shell: |

npm ci

npm run build

D.

- run:

npm ci

npm run build

Question 40

While awaiting approval, how many days can a workflow be in the “Waiting” state before it automatically fails?

Options:

A.

7 days

B.

14 days

C.

30 days

D.

60 days

Question 41

Which of the following scenarios requires a developer to explicitly use the GITHUB_TOKEN or github.token secret within a workflow? (Choose two.)

Options:

A.

passing the GITHUB_TOKEN secret to an action that requires a token as an input

B.

making an authenticated GitHub API request

C.

checking out source code with the actions/checkout@v3 action

D.

assigning non-default permissions to the GITHUB_TOKEN

Demo: 41 questions
Total 137 questions