GH-200 practice question 10 of 15

In which scenarios could the GITHUB_TOKEN be used? (Choose two.)

Full set: 100 questions
Answer options
A: to leverage a self-hosted runner
B: to create a repository secret
C: to publish to GitHub Packages Correct answer
D: to create issues in the repo Correct answer
E: to read from the file system on the runner
F: to add a member to an organization
Correct Answer:
C. to publish to GitHub Packages; D. to create issues in the repo
Explanation

The GITHUBTOKEN is a special access token that GitHub automatically creates for use in a workflow run. Its permissions are scoped to the repository containing the workflow. It can be used to authenticate against the GitHub API for various repository-level tasks. Common use cases include creating or updating issues, publishing packages to GitHub Packages, and creating releases. The token's permissions can be customized in the workflow file to adhere to the principle of least privilege, but by default, it has sufficient permissions for these actions.

Why Incorrect

A. Leveraging a self-hosted runner involves a registration token, which is distinct from the GITHUBTOKEN used for API authentication during a workflow run.
B. The GITHUBTOKEN does not have permissions to create or manage repository secrets. This requires a personal access token (PAT) with appropriate scopes.
E. Reading from the file system is a local operation on the runner and does not require authentication against the GitHub API via the GITHUBTOKEN.
F. Adding a member to an organization is an organization-level administrative action that requires a PAT with admin:org scope, which is beyond the GITHUBTOKEN's scope.

References

1. GitHub Docs, "Automatic token authentication". This document states, "GitHub automatically creates a GITHUBTOKEN secret to use in your workflow... You can use the GITHUBTOKEN to authenticate in a workflow run."

2. GitHub Docs, "Permissions for the GITHUBTOKEN". This page provides a detailed table of default permissions. It shows write access for issues and packages, confirming that the token can be used to create issues and publish packages.

Scroll to Top