Automatically sync your GitHub profile to your Discord Profile Widget every hour using GitHub Actions.
Important
Discord Profile Widgets (Experimental)
Discord Profile Widgets are currently an experimental feature. Follow Chloe Cinders' Blog Guide to enable the required Discord experiments, create and publish your widget, and add it to your Discord profile before continuing.
Click the Fork button at the top-right of this repository.
After creating your Discord Profile Widget, add the following fields under Games -> Widget in the Discord Developer Portal.
Note
For a complete visual guide with screenshots showing how to configure each field in the Discord Developer Portal, please refer to the docs/images directory.
| Field | Type | Description |
|---|---|---|
display_name |
String | GitHub display name |
username |
String | GitHub username |
joined |
String | GitHub account creation date |
avatar |
Media | GitHub profile avatar |
last_repo |
String | Most recently pushed repository |
last_commit |
String | Latest commit message |
stars |
Number | Total stars |
forks |
Number | Total forks |
repos |
Number | Total repositories |
streak |
String | Current contribution streak |
contributions |
Number | Contributions this year |
top_language |
String | Most used language |
followers |
Number | GitHub followers |
prs |
Number | Total pull requests |
- Go to the Discord Developer Portal and select your app.
- Copy the Application ID from General Information. (
DISCORD_APPLICATION_ID) - Copy your Bot token from the Bot tab (click Reset Token). (
DISCORD_BOT_TOKEN) - Click your profile in Discord and click Copy User ID. (
DISCORD_USER_ID) (Note: If this option does not appear, enable Developer Mode first in Discord Settings -> Developer).
- Go to GitHub Settings -> Developer Settings -> Personal Access Tokens (Classic).
- Generate a token with scopes:
read:userandrepo(orpublic_repo). - Copy the token. (
GH_PAT)
- Go to your forked repository's Settings tab.
- In the left sidebar, click Secrets and variables -> Actions.
- Under the Secrets tab (open by default), find Repository secrets section.
- Click the New repository secret button.
- Add the following secrets one by one by entering the Name and Value (ensure there are no leading or trailing spaces) and clicking Add secret:
| Secret Name | Description |
|---|---|
GH_USERNAME |
Your GitHub Username (e.g., AdityaLF) |
GH_PAT |
The GitHub Personal Access Token (from Step 4) |
DISCORD_APPLICATION_ID |
The Application ID of your Discord App (from Step 3) |
DISCORD_USER_ID |
Your Discord User ID (from Step 3) |
DISCORD_BOT_TOKEN |
The Discord Bot Token (from Step 3) |
- Go to the Actions tab of your repository.
- (First time only) If prompted, click "I understand my workflows, go ahead and enable them".
- In the left sidebar under Workflows, select Update Discord Profile Widget.
- On the right side, click the Run workflow dropdown and click the green Run workflow button to trigger the sync manually.
- Clone and install dependencies:
git clone https://github.com/AdityaLF/discord-github-profile-widget.git cd discord-github-profile-widget npm install - Rename
.env.exampleto.envin the root directory and fill:# GitHub Configuration GH_USERNAME=your_github_username GH_PAT=your_github_personal_access_token # Discord Configuration DISCORD_APPLICATION_ID=your_discord_application_id DISCORD_USER_ID=your_discord_user_id DISCORD_BOT_TOKEN=your_discord_bot_token
- Run the sync script:
npm start
Special thanks to Chloe Cinders for documenting Discord Profile Widgets and making this project possible.
This project is licensed under the MIT License.
