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.
Tip
Faster Setup Option
To avoid manually creating the widget, setting up the layout, and adding each field, you can use the Discord-Widgets-Extension by TheCreativeGod to import the pre-configured widget-config.json file. See the Widget Import Guide for step-by-step instructions.
Click the Fork button at the top-right of this repository.
(If you followed the Faster Setup Option, you can skip this step and proceed directly to Step 3).
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.
This project can also run as a Cloudflare Worker with a built-in hourly Cron Trigger, so you don't need to rely on GitHub Actions at all.
Important
Pick one scheduler. To avoid the widget being updated twice an hour (once by GitHub Actions and once by the Worker), disable the GitHub Actions workflow when using the Worker. No Settings needed — just edit one line at the top of .github/workflows/update-widget.yml: set DEFAULT_ENABLED: "false". (You can still force a manual run from the Actions tab via the force_run input.) Conversely, if you keep GitHub Actions, do not also deploy the Worker. Optionally, a repo variable GH_ACTIONS_ENABLED (Settings → Secrets and variables → Actions → Variables) can override the in-file default if you prefer.
Wrangler is not a project dependency — the Cloudflare build uses its own copy. If you want to deploy locally, install it globally:
npm install -g wranglerThe same credentials from Steps 3–4 are stored as Cloudflare secrets (not GitHub secrets):
wrangler secret put GH_USERNAME
wrangler secret put GH_PAT
wrangler secret put DISCORD_APPLICATION_ID
wrangler secret put DISCORD_USER_ID
wrangler secret put DISCORD_BOT_TOKEN
wrangler secret put MANUAL_TRIGGER_TOKEN # used to protect the manual HTTP triggerIf you connected your repo to Cloudflare via the dashboard, it auto-detects wrangler.toml and runs wrangler deploy on push. To deploy locally instead:
wrangler deployThe Worker is configured in wrangler.toml to run hourly via a Cron Trigger (0 * * * *). Note that sub-daily cron schedules require a Cloudflare Workers plan that supports them.
The Worker also exposes an HTTP endpoint so you can sync on demand:
curl -H "Authorization: Bearer $MANUAL_TRIGGER_TOKEN" https://<your-worker-subdomain>.workers.dev/Set MANUAL_TRIGGER_TOKEN to any secret string of your choice (the same value used in the secret above).
- 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
If you run into any issues during setup or syncing (such as the APPLICATION_IDENTITY_PROVIDER_USER_ID_MISMATCH error), please refer to the Troubleshooting Guide.
- Special thanks to Chloe Cinders for documenting Discord Profile Widgets and making this project possible.
- Thanks to TheCreativeGod for creating Discord-Widgets-Extension, which simplifies creating and configuring Discord Profile Widgets.
This project is licensed under the MIT License.
