GitHub Actions 工具,透過 GitHub GraphQL API 自動產生個人頁面統計卡片(SVG),並 commit 回儲存庫,讓你的 Profile README 保持最新狀態。
每次執行會在 output/github-profilemd-generater/<theme>/ 輸出:
| 檔案 | 說明 |
|---|---|
overview.svg |
總覽統計(Stars / Repos / Followers / Commits / PR / Issue) |
langcompos.svg |
語言組成(依實際程式碼位元組數計算) |
tagsstat.svg |
標籤 / 主題統計卡片 |
同時產生 output/README.md 片段,可直接嵌入你的 Profile README。
default | solarized | solarized_dark | vue | dracula | monokai | nord_bright | nord_dark | github | github_dark
前往 Settings → Secrets and variables → Actions 新增:
| Secret 名稱 | 說明 |
|---|---|
MY_GITHUB_TOKEN |
具備 read:user 與 repo 權限的 Personal Access Token |
📷 如何建立 Personal Access Token(圖解步驟)
| 步驟 | 操作 | 畫面 |
|---|---|---|
| 1 | 右上頭像選單 → Settings | ![]() |
| 2 | Developer settings → Personal access tokens → 點 Generate new token | ![]() |
| 3 | 勾選 repo 與 read:user scopes,產生後複製 token 貼到上方 Secret |
![]() |
# .github/workflows/generate-profile.yml
name: Generate profile cards
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' # 每週一自動執行
permissions:
contents: write # 允許 bot 將卡片 commit 回儲存庫
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: kwangsing3/github-profilemd-Generater@release
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
with:
USERNAME: ${{ github.repository_owner }}
GITHUB_REPO_NAME: ${{ github.event.repository.name }}
# 以下皆為選填
THEME: 'all' # 或逗號分隔,如 "nord_dark,dracula"
TOP_N: '8' # 語言 / 標籤顯示數量
HIDE: '' # 排除語言,如 "HTML,CSS"
OUTPUT_DIR: 'output'🔒 安全建議:正式環境請將
@release改為釘選 commit SHA(例如@<sha>),並只授予 workflow 必要的permissions。
| 輸入 | 必填 | 預設 | 說明 |
|---|---|---|---|
USERNAME |
✅ | repo owner | 要分析的 GitHub 帳號 |
GITHUB_REPO_NAME |
✅ | 當前 repo | 目標儲存庫名稱 |
THEME |
all |
all 或逗號分隔的主題清單 |
|
TOP_N |
8 |
每張卡顯示的語言 / 標籤數量 | |
HIDE |
(空) | 逗號分隔、要排除的語言 | |
OUTPUT_DIR |
output |
卡片輸出目錄 |
[](https://github.com/kwangsing3/github-profilemd-Generater)
[](https://github.com/kwangsing3/github-profilemd-Generater)
[](https://github.com/kwangsing3/github-profilemd-Generater)npm install
npm run build # 以 ncc 打包到 dist/
node dist/index.js <username> <repo_name> <github_token>產生結果寫入 OUTPUT_DIR(預設 output/);本地執行不會自動 git commit。
npm test # 執行單元測試(node:test)
npm run build # 打包 dist/(提交前務必重新建置)- 執行環境:Node.js 24(GitHub Actions
node24runtime)。 - 程式碼為 ESM;
dist/由@vercel/ncc打包後一併提交,CI 會驗證其與源碼同步。
MIT


