logo
Exam overview and study plan

GH-200 Practice Questions

GitHub Actions

Read questions, check verified answers and discuss the reasoning. Use reading options to shape your revision, or switch to the simulator for timed practice.

View 47 free questions

47 questions in this view

Page 1 of 8

Question 1

You have a GitHub repository named Repo1. Repo1 uses GitHub Actions workflows that upload build artifacts.

 

You plan to change the artifact and log retention period to 30 days.

 

You need to remove expired GitHub Actions artifacts from Repo1. The solution must explicitly identify and delete existing expired artifacts by using the REST API.

 

How should you complete the script? To answer, select the appropriate options in the answer area.

 

NOTE: Each correct selection is worth one point.

OWNER="Fabrikam"
REPO="Repo1"
artifact_ids=$(gh api \
--method \
\
--jq '.artifacts[]|select(.expired==true)|.id')
for artifact_id in $artifact_ids; do
gh api \
--method DELETE \
"/repos/$OWNER/$REPO/actions/artifacts/$artifact_id"
done

Question 2

Which YAML configuration will trigger a GitHub Actions workflow when a push is made to the main branch and a pull request is opened or synchronized on that branch?

Select an answer above, then submit your vote. Reading or practicing does not cast a vote.

Question 3

You have a GitHub repository that contains reusable custom actions.

 

You need to configure the following steps:

 

  • provision-cli: Uses a specific Linux base image and pinned versions of operating system packages and command-line tools
  • build-wrapper: Combines two shell commands and a checkout action into a single reusable workflow step

 

Which type of action should you use for each step? To answer, drag the appropriate action types to the correct steps. Each type may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

 

NOTE: Each correct selection is worth one point.

Actions
Answer Area
provision-cli:
build-wrapper:

Question 4

What are two reasons to keep an action in its own repository instead of bundling it with other application code? Each correct answer presents a complete solution.

NOTE: Each correct answer is worth one point.

Select an answer above, then submit your vote. Reading or practicing does not cast a vote.

Question 5

As a developer, you need to make sure that only actions from trusted sources are available for use in your GitHub Enterprise Cloud organization.

Which three statements are true? Each correct answer presents a complete solution.

NOTE: Each correct answer is worth one point.

Select an answer above, then submit your vote. Reading or practicing does not cast a vote.

Question 6

In which two scenarios could the GITHUB_TOKEN be used? Each correct answer presents a complete solution.

NOTE: Each correct answer is worth one point.

Select an answer above, then submit your vote. Reading or practicing does not cast a vote.