Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/generate-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Check METRICS_TOKEN format
if: ${{ !startsWith(secrets.METRICS_TOKEN, 'github_pat_') }}
run: |
echo "::warning::METRICS_TOKEN is missing or uses a legacy format. Add a fine-grained personal access token (github_pat_) as the METRICS_TOKEN secret to generate stats cards."

Comment on lines +20 to +24
# ── Card 1: General Stats ──────────────────────────────────────────────
- name: Generate Stats Card
if: ${{ startsWith(secrets.METRICS_TOKEN, 'github_pat_') }}
uses: lowlighter/metrics@latest
with:
token: ${{ secrets.METRICS_TOKEN }}
Expand All @@ -34,6 +40,7 @@ jobs:

# ── Card 2: Top Languages ──────────────────────────────────────────────
- name: Generate Languages Card
if: ${{ startsWith(secrets.METRICS_TOKEN, 'github_pat_') }}
uses: lowlighter/metrics@latest
with:
token: ${{ secrets.METRICS_TOKEN }}
Expand All @@ -50,6 +57,7 @@ jobs:

# ── Card 3: Contribution Calendar ─────────────────────────────────────
- name: Generate Isometric Calendar
if: ${{ startsWith(secrets.METRICS_TOKEN, 'github_pat_') }}
uses: lowlighter/metrics@latest
with:
token: ${{ secrets.METRICS_TOKEN }}
Expand Down
21 changes: 12 additions & 9 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@

---

### Step 1 — Create a Personal Access Token
### Step 1 — Create a Fine-Grained Personal Access Token

1. Go to **GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)**
2. Click **"Generate new token (classic)"**
1. Go to **GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens**
2. Click **"Generate new token"**
3. Name it: `METRICS_TOKEN`
Comment on lines +6 to 10
4. Set expiration: **No expiration** (or 1 year)
5. Select these scopes:
- ✅ `read:user`
- ✅ `repo` (needed to count private commits)
- ✅ `read:org`
6. Click **Generate token** — copy it immediately, you won't see it again
5. Set repository access to this repository (`whozahm3d/whozahm3d`)
6. Grant repository permissions:
- ✅ **Contents: Read and write**
7. Grant account permissions:
- ✅ **Profile: Read-only**
- ✅ **Metadata: Read-only**
8. Click **Generate token** — copy it immediately, you won't see it again

---

Expand Down Expand Up @@ -70,6 +72,7 @@ No maintenance needed.

| Problem | Fix |
|---|---|
| Action fails with "403 forbidden" | Token scopes are wrong — regenerate with `read:user`, `repo`, `read:org` |
| Action fails with "legacy or invalid token" | Regenerate a **fine-grained** PAT (`github_pat_...`) and save it as `METRICS_TOKEN` |
| Action fails with "403 forbidden" | Token permissions are wrong — ensure **Contents: Read and write** plus profile/metadata read access |
Comment on lines +75 to +76
| Action fails with "Resource not accessible" | Go to repo Settings → Actions → General → set Workflow permissions to "Read and write" |
| SVGs show but look wrong | Run the workflow again manually; first run sometimes has caching issues |