HOTSPOT (Drag and Drop is not supported)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.Hot Area:
Answer(s): A
Box 1: GETGET retrieves the list of GitHub Actions artifacts without modifying them.Box 2: "/repos/$OWNER/$REPO/actions/artifacts"/repos/$OWNER/$REPO/actions/artifacts is the GitHub REST API endpoint for listing artifacts in a specific repository.The jq expression filters artifacts where expired == true, and the subsequent DELETE requests target their IDs.
For which type of GitHub Actions workflows should you use a self-hosted runner?
Answer(s): B
Self-hosted runners are primarily used for workflows that require specialized hardware, private network access, custom software configurations, or strict cost and security controls. While technically any standard GitHub Actions workflow can target a self-hosted runner, organizations deploy them to handle specific scenarios where standard GitHub-hosted runners fall short.Workflows Requiring Private Network AccessInternal Deployments: Workflows deploying code to internal servers, private databases, or environments tucked safely behind a corporate firewall.On-Premises Testing: Verification jobs that must interact with physical laboratory equipment or locally hosted APIs.VPN-Protected Infrastructure: Pipelines needing direct, secure access to private subnets inside AWS, Azure, Google Cloud, or local data centers without exposing ports to the public internet.Workflows with Custom Software & OS RequirementsLegacy System Builds: Automation requiring specialized operating systems, unique kernel versions, or specific distributions not offered by GitHub.Proprietary Tooling: Workflows that depend on expensive licensed commercial software, massive SDKs, or pre-configured local caching engines.Persistent Cache Pipelines: Large-scale builds (like heavy C++ or Android compilations) that benefit significantly from a persistent file system to avoid re-downloading gigabytes of dependencies for every single run.High-Performance & Custom Hardware WorkflowsMachine Learning Pipelines: Training workflows that demand dedicated, high-end physical GPUs.Large Compute Jobs: Resource-heavy builds requiring vast amounts of RAM, multiple CPU cores, or high disk I/O beyond what standard virtual cloud instances provide.
https://docs.github.com/actions/hosting-your-own-runners
As a developer, you are using a Docker container action in your workflow. What is required for the action to run successfully?
Answer(s): D
To run a Docker container action, the job's runs-on environment must be a Linux machine that has Docker installed.Key RequirementsLinux OS Only: Docker container actions are only supported on Linux runners. They cannot run on Windows or macOS runners.Docker Installed: The runner must have the Docker CLI and daemon installed and running to build and execute the action's container.GitHub-Hosted Runners: If you use GitHub-hosted runners, you must specify an Ubuntu environment (e.g., runs-on: ubuntu-latest), as these come pre-configured with Docker.Self-Hosted Runners: For self-hosted runners, you must manually ensure the machine is running Linux and has Docker installed.
https://docs.github.com/actions/sharing-automations/creating-actions/creating-a-docker-container-action
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. Choose two.)
Answer(s): A,E
You need to trigger a workflow using the GitHub API for activity that happens outside of GitHub. Which workflow event do you use?
You can use the GitHub API to trigger a webhook event called repository_dispatch when you want to trigger a workflow for activity that happens outside of GitHub .
https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows
You are a DevOps engineer working on a custom action. You want to conditionally run a script at the start of the action, before the main entrypoint. Which code block should be used to define the metadata file for your custom action?
The pre: line before the pre-if: line.Note: runs.pre-ifOptionalAllows you to define conditions for the pre: action execution. The pre: action will only run if the conditions in pre-if are met. If not set, then pre-if defaults to always(). In pre-if, status check functions evaluate against the job's status, not the action's own status.Note that the step context is unavailable, as no steps have run yet.In this example, cleanup.js only runs on Linux-based runners:pre: 'cleanup.js'pre-if: runner.os == 'linux'
https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax
As a developer, one of your workflows will require XCode version 11.2 hosted on macOS Catalina (i.e., v10.15). You’ve 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 answer presents a complete solution. Choose three.)
Answer(s): C,E,F
[C, F] Using custom labels to route jobsYou can create custom labels and assign them to your self-hosted runners at any time. Custom labels let you send jobs to particular types of self-hosted runners, based on how they're labeled.[E] Using default labels to route jobsA self-hosted runner automatically receives certain labels when it is added to GitHub Actions. These are used to indicate its operating system and hardware platform:self-hosted: Default label applied to self-hosted runners.linux, windows, or macOS: Applied depending on operating system.x64, ARM, or ARM64: Applied depending on hardware architecture.You can use your workflow's YAML to send jobs to a combination of these labels. In this example, a self-hosted runner that matches all three labels will be eligible to run the job:runs-on: [self-hosted, linux, ARM64]self-hosted - Run this job on a self-hosted runner.linux - Only use a Linux-based runner.ARM64 - Only use a runner based on ARM64 hardware.
https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/use-in-a-workflow
When reviewing an action for use, what file defines its available inputs and outputs?
Answer(s): E
A custom GitHub Action's inputs, outputs, and other configurations are defined in its metadata file, which must be named action.yml or action.yaml and placed at the root of the action's repository. This YAML file specifies how the action runs (e.g., using Docker or JavaScript) and provides the metadata for its inputs and outputs, which are then used by workflows that call the action.Key aspects of the action.yml or action.yaml fileFormat: It uses YAML syntax.Location: It must be in the root directory of your action's repository.Contents: It defines the action's name, description, inputs, outputs, and the runs configuration to specify the execution environment (like a Docker image or JavaScript file) and entrypoint.Inputs and Outputs: The file includes inputs and outputs sections to declare the data the action accepts and produces, respectively.
Share your comments for Microsoft GH-200 exam with other users:
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 }}
$VARIABLE
GITHUB_
defaults:
run
GITHUB_WORKSPACE
${{ github.workspace }}
$GITHUB_WORKSPACE/...
${{ github.workspace }}/...