Skip to content

New Share your ideas with the AWTRIX community. Keep your creations together in your account.

Sign in

Which AWTRIX do you have? Choose it once and the Hub shows what runs on it.

ScriptAWTRIX NG

GitHub Heatmap

On an AWTRIX display
GitHub Heatmap shown on an AWTRIX display
GitHub Heatmap · by Golevka2001

On your display

Show off your GitHub contributions right on your AWTRIX.

Which AWTRIX do you have? See below where it runs, or choose your device.
Topic
Social
Includes
Script

Runs on

  • Runs on 32×8 (TC001 & DIY)
  • Runs on 52×16 (TC002)
  • Does not run on 32×8 with AWTRIX 3 (TC001 & DIY) Made for AWTRIX NG.

Choose your display in the next step.

Send to AWTRIX

Choose your AWTRIX

GitHub HeatmapAWTRIX NG script

Install this script on your AWTRIX NG. Its icons and sounds are installed with it.

Your AWTRIX’s local address, for example 192.168.178.39 or awtrix.local.

The name shown in your AWTRIX script list. Use letters, digits, hyphens or underscores.

Connection & device login

Connect your phone or computer to the same network as your AWTRIX. Allow local network access if your browser asks.

Use the device’s IP address, without a page path such as /#/apps.

If your AWTRIX requires a login, the username and password fields will appear when you connect.

Sign in to the Hub to install scripts. Attached files are installed separately.

Is this your script?

If you created this script, open your saved edit link to add it to your account. You can then manage it whenever you sign in. Adding it to your account replaces the edit link.

Script description

English | 简体中文

A GitHub contribution heatmap for AWTRIX NG, rendered on the 32×8 LED panel.

AWTRIX app ──▶ Cloudflare Worker ──GraphQL──▶ GitHub API
    ▲                 │
    └── 256 pixels ◀──┘    JSON array of 0xRRGGBB ints, 32×8 row-major

Rendering conventions: the panel shows the last 32 weeks; rows 1–7 map Sunday through Saturday, the rightmost column is the current week, and row 0 carries the month marker. With Show Avatar on, the leftmost 8 columns render the user's 8×8 avatar.

1. Create a GitHub token

The worker only reads public data, so a classic personal access token with the read:user scope is all it needs.

  1. Create one at https://github.com/settings/tokens/new.
  2. Name it and tick read:user.
  3. Generate and store it somewhere safe. You will need it in step 2.

2. Deploy the worker

(Recommended) Deploy with the button

Deploy to Cloudflare

Click the button to deploy the worker.

Add a secret named GITHUB_TOKEN and paste the token from step 1.

Manual Deployment

To deploy manually instead, you need to clone the repo and install wrangler:

cd worker
wrangler secret put GITHUB_TOKEN  # paste the token from step 1
wrangler deploy

You will see a URL like https://awtrixng-github-heatmap-worker.xxx.workers.dev. Test it with your GitHub username:

curl "https://awtrixng-github-heatmap-worker.xxx.workers.dev/?user=<github-username>"
# [0,934953,27954,934953,...]  exactly 256 integers

You can also bind the worker to a custom domain instead of *.workers.dev.

3. (Optional) Protect the worker with Cloudflare Access

Left open, anyone with the URL can query arbitrary accounts and burn your API quota. Access control is recommended.

  1. Create a new service token: Zero Trust - Access Controls - Service Credentials - Create Service Token.
    Note the Client ID and Client Secret (the secret is shown only once).
  2. Create a new Access policy: Zero Trust - Access Controls - Policies - Add a Policy.
    • Include = Service Token - the token created above
    • Action = Service Auth
  3. Add an application: Zero Trust - Access Controls - Applications - Add an Application - Self-hosted - Workers.
    • Destinations/Workers/Scope = awtrixng-github-heatmap-worker
    • Access Policies = the policy created above

Test the worker again, you will see the Cloudflare Access error page:

curl "https://<worker-url>/?user=<github-username>"
# <!doctype html>
# <html>
#   <head>
#     <title>Error ・ Cloudflare Access</title>
# ...

You need to pass the service token in the CF-Access-Client-Id and CF-Access-Client-Secret headers:

curl "https://<worker-url>/?user=<github-username>" \
     -H "CF-Access-Client-Id: <client-id>" \
     -H "CF-Access-Client-Secret: <client-secret>"
# [0,934953,27954,934953,...]  exactly 256 integers

4. Install and configure the app

The app is published on AWTRIX Flows — install it from there, or visit the AWTRIX NG web interface, go to Scripts and paste github-heatmap.ax into a new script. Configure it with the following settings:

Setting Value
Server URL The worker URL from step 2
Username GitHub username
(Optional) CF Access Client ID / Secret The service token from step 3. Leave empty if not using Cloudflare Access
Rainbow Months Color the month markers with a per-month hue; on by default
Split by Month Add a gap between months; off by default
Show Avatar Render the user's 8×8 avatar in the leftmost columns; off by default
Refresh Refresh interval in minutes

Behavior notes: the select button forces an immediate refresh; failed requests back off exponentially starting at 30 s, capped at every; until the first fetch succeeds the panel shows ..., which becomes an orange ? once a fetch has failed.

More scripts in Social

Something wrong with this script? Report it.