Obtain a GitHub Personal Access Token (classic token)
In this milestone, you create a GitHub Personal Access Token that allows your Grafana data source to authenticate with the GitHub API. The token provides the necessary permissions to read repository data including issues, pull requests, and other metrics.
GitHub Personal Access Tokens serve as an authentication method for API access. For the GitHub data source, you can use one of the following:
- personal access token (classic)
- fine-grained personal access token
You can find more information about the personal access tokens on the GitHub documentation page.
Note
You can also use the GitHub App Authentication instead of a personal access token for better security and fine-grained access to resources.
For now, you will continue the learning journey by creating a a classic token with specific repository permissions to access the data you want to visualize in your dashboards.
To create a GitHub Personal Access Token, complete the following steps:
Sign in to your GitHub account at
github.com
.Click your profile avatar in the upper right corner and select Settings.
In the left sidebar, scroll down and click Developer settings.
Click Personal access tokens > Tokens (classic).
Click Generate new token > Generate new token (classic).
In the Note field, enter a descriptive name for the token.
For example, enter
Grafana Cloud GitHub Data Source
.Set the Expiration based on your organization’s security policies.
For testing purposes, you can select 7 days. For production use, consider your organization’s token rotation policies.
Under Select scopes, select the following permissions:
For all repositories:
public_repo
,repo:status
,repo_deployment
,read:packages
,read:user
,user:email
For GitHub projects:
read:org
,read:project
An extra setting is required for private repositories:
repo
(Full control of private repositories)
Click Generate token at the bottom of the page.
Copy the generated token immediately and store it securely. GitHub will not display the token again after you leave this page.
Caution
Treat your Personal Access Token like a password. Store it securely and never commit it to version control or share it publicly.
You now have a GitHub Personal Access Token that can be used to authenticate your GitHub data source. Keep the token secure and readily accessible for the next milestone.
In the next milestone, you’ll install and add the GitHub data source plugin in your Grafana Cloud instance.