This guide explains how to generate the necessary credentials (GITHUB_TOKEN, SLACK_TOKEN, etc.) to run the GitHub Reporter.
- If you haven't already, copy the example environment file:
cp .env.example .env
- Open
.envin your editor. You will be pasting the tokens here.
You need a Personal Access Token (Classic) to fetch data from GitHub.
-
Go to Token Settings:
- Navigate to github.com/settings/tokens.
- (Or: Settings -> Developer settings -> Personal access tokens -> Tokens (classic))
-
Generate Token:
- Click Generate new token -> Generate new token (classic).
- Note: Name it something like "GitHub Reporter".
- Expiration: Set an expiration date (or "No expiration" for long-running servers, but be careful).
-
Select Scopes: Check the following boxes:
-
repo(Full control of private repositories) - Required for private repo access. -
read:org(Read org and team membership) - Required for verifying org access. -
read:user(Optional, for user profile data).
-
-
Authorize SSO (CRITICAL for Organizations):
- If your organization uses SAML Single Sign-On (SSO):
- After generating the token, click the Configure SSO button next to the new token.
- Click Authorize for your specific organization.
- If you skip this, the token will fail to access organization resources.
-
Save Credentials:
- Copy the token (starts with
ghp_). - Paste it into your
.envfile:GITHUB_TOKEN=ghp_your_token_here
- Copy the token (starts with
If you want the reporter to post updates to Slack, you need a Slack App.
- Go to api.slack.com/apps.
- Click Create New App.
- Select From scratch.
- Name it (e.g., "GitHub Reporter") and select your Workspace.
- In the left sidebar, click OAuth & Permissions.
- Scroll down to Scopes -> Bot Token Scopes.
- Click Add an OAuth Scope and add:
chat:write(Required to send messages).files:write(Optional, if uploading stats files).
- Scroll up to the top of the OAuth & Permissions page.
- Click Install to Workspace.
- Accept the permissions.
- Copy the Bot User OAuth Token (starts with
xoxb-...). - Paste it into your
.env:SLACK_TOKEN=xoxb-your-token-here
- Open Slack and right-click the channel you want to post to.
- Select Copy Link.
- The link looks like
https://.../archives/C12345678. - The ID is the last part:
C12345678. - Paste it into your
.env:SLACK_CHANNEL=C12345678
Vital Step: The bot cannot post until it is in the channel.
- Go to the Slack channel.
- Type
/invite @GitHub Reporter(or your bot's name). - Press Enter to add the bot.