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?
Answer(s): B
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
Post your Comments and Discuss Microsoft GH-200 exam prep with other Community members: