快速开始
根据你想在哪里生成卡片,选择相应的集成方式。
- 在 CI 或本地生成卡片。
- 把文件发布到分支、构件或公开目录。
- 在个人主页 README 中嵌入发布的文件。
GitHub Action
这个工作流每天渲染四张卡片,并通过 publish_branch 提交到 output 分支,替换上一次提交以保持仓库精简。每个配置选项也是 Action 输入,作业摘要会显示预览和 README 片段。
.github/workflows/profile-graphics.yml
name: Generate profile graphics
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: mikhailkhorokhorin/profile-graphics@v1
with:
user: ${{ github.repository_owner }}
token: ${{ secrets.GITHUB_TOKEN }}
charts: streak,summary,langs,calendar
publish_branch: output
嵌入 README
把 <user> 换成你的 GitHub 用户名。每张卡片一张图片,或用 layout: dashboard 合成一张图片。
README.md




GitLab CI
把具有 read_user 和 read_api 权限范围的令牌保存为 CI 变量 GITLAB_TOKEN。
.gitlab-ci.yml
stages:
- generate
generate-profile-graphics:
image: node:22
stage: generate
script:
- npm install -g profile-graphics
- profile-graphics generate --provider gitlab --user "$GITLAB_USER_LOGIN" --token "$GITLAB_TOKEN" --output public/cards
artifacts:
paths:
- public/cards
CLI
写出初始配置、在本地生成、无需令牌试用主题,或预览配置。
shell
npm install -g profile-graphics
profile-graphics init --user octocat
profile-graphics generate --user octocat --token "$GITHUB_TOKEN" --charts streak,langs --output dist
profile-graphics demo --theme tokyo-night --output dist/demo
profile-graphics preview --config profile-graphics.yml --demo