Free GH-200 Exam Braindumps
GitHub Actions Questions 41–45 (page: 10)

Updated On: 16-Nov-2026

Which of the following is the proper syntax to specify a custom environment variable named MY_VARIABLE with the value my-value?

  1. var:
    MY_VARIABLE = my-value
  2. environment:
    MY_VARIABLE = my-value
  3. var:
    MY_VARIABLE: my-value
  4. env:
    MY_VARIABLE = my-value
  5. environment:
    MY_VARIABLE: my-value
  6. env:
    MY_VARIABLE: my-value

Answer(s): F

Explanation:

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: Monday
Note: 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.


Reference:

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.)

  1. passing the GITHUB_TOKEN secret to an action that requires a token as an input
  2. making an authenticated GitHub API request
  3. checking out source code with the actions/checkout@v3 action
  4. assigning non-default permissions to the GITHUB_TOKEN

Answer(s): A,B

Explanation:

[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 API
run: |
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


Reference:

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.)

  1. You can use standard GitHub-hosted runners since their IP addresses are automatically allowed.
  2. You can use self-hosted runners with known IP addresses.
  3. You must allow GitHub Actions’s IP address ranges in order to use marketplace actions.
  4. You can use GitHub-hosted larger runners since they can be configured with static IP addresses.

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?

  1. jobs:
    deploy:
    if: github.ref_name == 'feature-branch'
    runs-on: ubuntu-latest steps:
    - uses: actions/checkout@v3
  2. jobs:
    deploy:
    if: github.branch.name == 'feature-branch'
    runs-on: ubuntu-latest steps:
    - uses: actions/checkout@v3
  3. jobs:
    deploy:
    if: github.ref.name == 'feature-branch'
    runs-on: ubuntu-latest steps:
    - uses: actions/checkout@v3
  4. jobs:
    deploy:
    if: github.branch_name == 'feature-branch'
    runs-on: ubuntu-latest steps:
    - uses: actions/checkout@v3

Answer(s): A

Explanation:

"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.


Reference:

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?

  1. workflows that require access to private internal network resources
  2. workflows that have no specific environment configurations and must be triggered on a GitHub-hosted infrastructure
  3. short-lived workflows that do NOT require custom dependencies
  4. workflows that require the latest operating system and preinstalled software versions

Answer(s): A

Explanation:

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.


Reference:

https://github.blog/enterprise-software/ci-cd/when-to-choose-github-hosted-runners-or-self-hosted-runners-with -github-actions



Viewing page 10 of 28
Viewing questions 46 - 50 out of 134 questions


Post your Comments and Discuss Microsoft GH-200 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!