Which of the following is the proper syntax to specify a custom environment variable named MY_VARIABLE with the value my-value?
Answer(s): F
To set a custom environment variable for a single workflow, you can define it using the env key in the workflow file.Example:env:DAY_OF_WEEK: MondayNote: The scope of a custom variable set by this method is limited to the element in which it is defined. You can define variables that are scoped for:The entire workflow, by using env at the top level of the workflow file.The contents of a job within a workflow, by using jobs.<job_id>.env.A specific step within a job, by using jobs.<job_id>.steps[*].env.
https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables
Which of the following scenarios requires a developer to explicitly use the GITHUB_TOKEN or github.token secret within a workflow? (Choose two.)
Answer(s): A,B
[A] Some actions may require a GITHUB_TOKEN as an input to authenticate and perform specific tasks, such as creating issues, commenting on pull requests, or interacting with the GitHub API. In such cases, you would need to explicitly pass the token to the action.[B] When making an authenticated GitHub API request, the GITHUB_TOKEN is required to authenticate the request. This token is automatically provided by GitHub in the workflow, and it must be explicitly used when interacting with the GitHub API.Note: You can use the GITHUB_TOKEN to make authenticated API calls. This example workflow creates an issue using the GitHub REST API:name: Create issue on commit on: [ push ]jobs:create_issue:runs-on: ubuntu-latest permissions:issues: write steps:- name: Create issue using REST APIrun: |curl --request POST \--url https://api.github.com/repos/${{ github.repository }}/issues \--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \--header 'content-type: application/json' \--data '{"title": "Automated issue for commit: ${{ github.sha }}","body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_."}' \--fail
https://docs.github.com/en/actions/tutorials/authenticate-with-github_token
As a developer, you have configured an IP allow list on a GitHub organization. Which effects does the IP allow list have on GitHub Actions? (Each answer presents a complete solution. Choose two.)
Answer(s): B,C
You are a DevOps engineer working on deployment workflows. You need to execute the deploy job only if the current branch name is feature-branch. Which code snippet will help you to implement the conditional execution of the job?
Answer(s): A
"ref_name" refers to the short name of a Git branch or tag, as seen on platforms like GitHub, and is often used in CI/CD workflows to specify which code to build or deploy. For example, when a workflow is triggered by a commit to the feature-branch-1 branch, the github.ref_name would be feature-branch-1.In GitHub Actions:Purpose:github.ref_name is a read-only context variable that contains the short name of the branch or tag that triggered the workflow.Examples:If a workflow is triggered by a commit to the main branch, github.ref_name would be main.If it's triggered by a new tag, such as v1.2.3, github.ref_name would be v1.2.3.
https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
For which type of GitHub Actions workflows should you use a self-hosted runner?
Self-hosted Runners: These run on your own infrastructure (on-premises or cloud). They are primarily used when you need specific environment configurations, such as custom hardware (GPUs), specific operating systems, or access to internal resources behind a firewall.Using self-hosted runners is a standard solution for accessing private internal network resources, as they can be placed directly within your on-premises or cloud-based private network.Incorrect:[Not B]For GitHub Actions workflows with no specific environment configurations that must be triggered on GitHub-hosted infrastructure, you should typically use GitHub-hosted runners, not self-hosted ones.
https://github.blog/enterprise-software/ci-cd/when-to-choose-github-hosted-runners-or-self-hosted-runners-with -github-actions
Post your Comments and Discuss Microsoft GH-200 exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the GH-200 content, but please register or login to continue.