1. สร้างการ์ดใน CI หรือบนเครื่อง
  2. เผยแพร่ไฟล์ไปยังบรานช์ อาร์ทิแฟกต์ หรือไดเรกทอรีสาธารณะ
  3. ฝังไฟล์ที่เผยแพร่ใน README โปรไฟล์ของคุณ

GitHub Action

เวิร์กโฟลว์นี้เรนเดอร์การ์ดสี่ใบทุกวันและคอมมิตไปยังบรานช์ output ผ่าน publish_branch โดยแทนที่คอมมิตก่อนหน้าเพื่อให้รีโพมีขนาดเล็ก ตัวเลือกการตั้งค่าทุกตัวเป็นอินพุตของ 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
![Streak](https://raw.githubusercontent.com/<user>/<user>/output/streak.svg)
![Summary](https://raw.githubusercontent.com/<user>/<user>/output/summary.svg)
![Languages](https://raw.githubusercontent.com/<user>/<user>/output/langs.svg)
![Calendar](https://raw.githubusercontent.com/<user>/<user>/output/calendar.svg)

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