nerdexam
Microsoft

GH-200 · Question #46

When should you use the GITHUB_TOKEN in a workflow?

The correct answer is A. when you want to make authenticated calls to the GitHub API. GITHUB_TOKEN is an automatically generated token that GitHub creates at the start of each workflow run. Its purpose is to authenticate API calls to the GitHub API on behalf of the workflow (e.g., creating issues, commenting on PRs, managing releases). It is not used for SSH…

Author and Maintain Workflows

Question

When should you use the GITHUB_TOKEN in a workflow?

Options

  • Awhen you want to make authenticated calls to the GitHub API
  • Bwhen you want to connect to the runner via SSH
  • Cwhen you want to access repository-level secrets
  • Dwhen you want to call an action from the marketplace

How the community answered

(36 responses)
  • A
    92% (33)
  • B
    6% (2)
  • C
    3% (1)

Explanation

GITHUB_TOKEN is an automatically generated token that GitHub creates at the start of each workflow run. Its purpose is to authenticate API calls to the GitHub API on behalf of the workflow (e.g., creating issues, commenting on PRs, managing releases). It is not used for SSH access to runners, accessing repository secrets (those are accessed directly via ${{ secrets.SECRET_NAME }}), or calling marketplace actions (those are referenced by uses:).

Topics

#GITHUB_TOKEN#GitHub API#Workflow authentication

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice