GH-200 · Question #94
Which of the following scenarios requires a developer to explicitly use the GITHUB_TOKEN or github.token secret within a workflow? (Choose two.)
The correct answer is A. passing the GITHUB_TOKEN secret to an action that requires a token as an input B. making an authenticated GitHub API request. [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
Question
Which of the following scenarios requires a developer to explicitly use the GITHUB_TOKEN or github.token secret within a workflow? (Choose two.)
Options
- Apassing the GITHUB_TOKEN secret to an action that requires a token as an input
- Bmaking an authenticated GitHub API request
- Cchecking out source code with the actions/checkout@v3 action
- Dassigning non-default permissions to the GITHUB_TOKEN
How the community answered
(25 responses)- A88% (22)
- C4% (1)
- D8% (2)
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: https://docs.github.com/en/actions/tutorials/authenticate-with-github_token
Topics
Community Discussion
No community discussion yet for this question.