Add a chart to a GitHub README
GitHub Markdown can't run chart code, but it shows images. Render the chart once and paste its link as a Markdown image; a small GitHub Action can refresh it on a schedule.
1. Get a chart link
Call the API once with your key (or ask an AI assistant with the MCP server to make the chart). Use the url from the answer (the MCP tool also gives you a ready-made Markdown line).
curl -s -X POST "https://kitforge-chart-api.kitforgelabs.workers.dev/v1/chart?response=json" \
-H "Authorization: Bearer YOUR_KEY" -H "content-type: application/json" \
-d '{"type":"line","title":"GitHub stars","values":true,
"labels":["Jul","Aug","Sep","Oct","Nov"],"data":[120,180,260,410,530]}' | jq -r .url2. Paste it into the README
GitHub serves the image through its own image cache, so your readers never call our API directly, and viewing the chart is free.
3. Optional: keep it up to date with a GitHub Action
A signed URL always shows the same numbers. To update the chart, render a new one and replace the link. Store your key as the repository secret KITFORGE_KEY and mark the image in the README with <!-- chart --> comments:
# .github/workflows/chart.yml
name: Update README chart
on:
schedule: [{ cron: '0 6 * * 1' }] # Mondays 06:00 UTC
workflow_dispatch:
permissions: { contents: write }
jobs:
chart:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Render chart
env: { KITFORGE_KEY: ${{ secrets.KITFORGE_KEY }} }
run: |
# Build your numbers here (from a file, an API, git history …)
BODY='{"type":"line","title":"Weekly downloads","labels":["W1","W2","W3","W4"],"data":[310,420,390,510]}'
URL=$(curl -sf -X POST "https://kitforge-chart-api.kitforgelabs.workers.dev/v1/chart?response=json" \
-H "Authorization: Bearer $KITFORGE_KEY" -H "content-type: application/json" -d "$BODY" | jq -r .url)
perl -0pi -e "s|<!-- chart -->.*?<!-- /chart -->|<!-- chart --><!-- /chart -->|s" README.md
- name: Commit
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am "Update README chart" || echo "No change"
git pushEach run with new numbers uses one credit; a run with unchanged numbers renders the same chart again for free. A weekly chart for a year is 52 credits, well inside the 50 free ones.
The same image link works in GitLab, Notion, Obsidian, Docusaurus and anything else that shows Markdown images.
More guides: Charts in email · Charts from AI assistants (MCP) · Charts in n8n