Pre-Summer Sale Special - Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: mxmas70

Home > Microsoft > GitHub Administrator > GH-200

GH-200 GitHub Actions Exam Question and Answers

Question # 4

What is the smallest scope for an environment variable?

A.

the workflow settings

B.

a step

C.

a job

D.

the workflow env mapping

Full Access
Question # 5

A development team has been using a Powershell script to compile and package their solution using existing tools on a Linux VM, which has been configured as a self-hosted runner. They would like to use the script as-is in an automated workflow. Which of the following should they do to invoke their script within a workflow step?

A.

Configure a self-hosted runner on Windows with the requested tools.

B.

Use the YAML powershell: step.

C.

Run the pwsh2bash command to convert the script so it can be run on Linux.

D.

Use the YAML shell: pwsh in a run step.

E.

Use the actions/run-powershell action to invoke the script.

Full Access
Question # 6

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?

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.

Full Access
Question # 7

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?

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/** '

Full Access
Question # 8

You are a developer, and your container jobs are failing on a self-hosted runner. Which requirements must you check to ensure that the self-hosted runner is properly configured? (Choose two.)

A.

The self-hosted runner is running a Linux operating system.

B.

The self-hosted runner is running a Windows operating system.

C.

Docker is installed on the self-hosted runner.

D.

Kubernetes is installed on the self-hosted runner.

E.

The service status of Kubernetes is " active " .

Full Access
Question # 9

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?

A.

Insights

B.

Code

C.

Actions

D.

Pull requests

E.

Issues

Full Access
Question # 10

What are the advantages of using a matrix strategy in a job definition? (Choose two.)

A.

It can test code in multiple versions of a programming language.

B.

It can decrease the costs for running multiple combinations of programming language/operating systems.

C.

It can run up to 512 jobs per workflow run.

D.

It can test code in multiple operating systems.

Full Access
Question # 11

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?

A.

.github/workflows

B.

.github/templates

C.

.github/workflow-templates

D.

the root directory of each repository

Full Access
Question # 12

Which workflow command would output the debug message " action successfully debugged " ?

A.

echo :debug::message=action successfully debugged "

B.

echo " debug-action successfully debugged "

C.

echo " ::debug::action successfully debugged "

D.

echo " :debug:action successfully debugged: "

Full Access
Question # 13

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?

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

Full Access
Question # 14

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?

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.

Full Access
Question # 15

Which statement is true about using default environment variables?

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.

Full Access
Question # 16

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

A)

B)

C)

D)

A.

Option A

B.

Option B

C.

Option C

D.

Option D

Full Access
Question # 17

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

A.

@actions/github toolkit

B.

JavaScript dist/ folder

C.

Dockerfile CMD

D.

a non-zero exit code

E.

output variable

F.

composite run step

Full Access
Question # 18

Without the need to use additional infrastructure, what is the simplest and most maintainable method for configuring a workflow job to provide access to an empty PostgreSQL database?

A.

Use service containers with a Postgres database from Docker hub.

B.

Run the actions/postgres action in a parallel job.

C.

It is currently impossible to access the database with GitHub Actions.

D.

Dynamically provision and deprovision an environment.

Full Access
Question # 19

As a developer, you need to add the correct syntax to allow the following workflow file to be triggered by multiple types of events.

Which two code blocks should you add starting at line 5? Each correct answer presents a complete solution.

NOTE: Each correct answer is worth one point.

4 name: Node CI/CD

5

6

7

8 jobs:

9 build:

10 runs-on:

11 steps:

12 - uses: actions/checkout@v2

13 - uses: actions/setup-node@v1

14 with:

15 node-version: 12

16 - run: npm ci

17 - run: npm test

18

A.

on:

env:

- ' prod '

- ' qa '

- ' test '

B.

on: [push, commit]

C.

on: [push, pull_request]

D.

on:

branches:

- ' main '

- ' dev '

E.

on:

push:

branches:

- main

release:

types:

- created

F.

on:

schedule:

- cron: ' */15 * * * * '

initiate:

- ' main '

Full Access
Question # 20

As a developer, how can you identify a Docker container action on GitHub?

A.

The action ' s repository includes @actions/core in the root directory.

B.

The action ' s repository name includes the keyword " Docker. "

C.

The action.yml metadata file references a Dockerfile file.

D.

The action.yml metadata file has the runs.using value set to Docker.

Full Access
Question # 21

As a developer, you have a 10-MB data set that is required in a specific workflow. Which steps should you perform so the dataset is stored encrypted and can be decrypted during the workflow? (Choose three.)

A.

Encrypt the dataset.

B.

Leverage the actions/download-secret action in the workflow.

C.

Store the dataset in a GitHub encrypted secret.

D.

Store the encryption keys in a GitHub encrypted secret.

E.

Compress the dataset

F.

Commit the encrypted dataset to the same repository as the workflow

G.

Create a GitHub encrypted secret with the Large object option selected and upload the dataset.

Full Access
Question # 22

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

A.

inputs.yml

B.

config.json

C.

defaults.json

D.

workflow.yml

E.

action.yml

Full Access
Question # 23

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

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

Full Access
Question # 24

As a developer, how can you identify a composite action on GitHub?

A.

The action’s repository includes Dockerfile and package.json files.

B.

The action.yml metadata file has the runs.using value set to composite.

C.

The action’s repository name includes the keyword “composite.”

D.

The action’s repository includes an init.sh file in the root directory.

Full Access
Question # 25

Which files are required for a Docker container action in addition to the source code? (Choose two.)

A.

Dockerfile

B.

Actionfile

C.

metadata.yml

D.

action.yml

Full Access
Question # 26

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

A.

Actions > Load workflow

B.

Workflow > New workflow

C.

Workflow > Load workflow

D.

Actions > New workflow

Full Access
Question # 27

As a developer, your self-hosted runner sometimes looses connection while running jobs. How should you troubleshoot the issue affecting your self-hosted runner?

A.

Set the DEBUG environment variable to true before starting the self-hosted runner to produce more verbose console output.

B.

Locate the self-hosted runner in your repository ' s settings page and download its log archive.

C.

Access the self-hosted runner ' s installation directory and look for log files in the _diag folder.

D.

Start the self-hosted runner with the --debug flag to produce more verbose console output.

Full Access
Question # 28

You installed specific software on a Linux self-hosted runner. You have users with workflows that need to be able to select the runner based on the identified custom software. Which steps should you perform to prepare the runner and your users to run these workflows? (Choose two.)

A.

Create the group custom-software-on-linux and move the runner into the group.

B.

Inform users to identify the runner based on the group.

C.

Add the label custom-software to the runner.

D.

Configure the webhook and network to enable GitHub to trigger workflow.

E.

Add the label linux to the runner.

Full Access
Question # 29

What will the output be for the following event trigger block in a workflow?

A.

It throws a workflow syntax error, pointing to the types definition in issue_comment event.

B.

It throws a workflow syntax error, pointing to the types definition in issues event.

C.

It runs the workflow when an issue is edited or when an issue comment created.

D.

It runs the workflow when an issue or issue comment in the workflow ' s repository is created or modified.

E.

It runs the workflow when an issue is created or edited, or when an issue or pull request comment is created.

Full Access
Question # 30

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

A.

POST /repos/:owner/:repo/actions/runs/:run_id

B.

GET /repos/:owner/:repo/actions/artifacts/logs

C.

GET /repos/:owner/:repo/actions/runs/:run_id/logs

D.

POST /repos/:owner/:repo/actions/runs/:run_id/logs

Full Access