|
1 | 1 | # GitHub Dashboard |
2 | 2 |
|
3 | | -Config-driven static dashboard for tracking issues, PRs, and CI health. Auto-deployed to GitHub Pages via Actions. |
4 | | - |
5 | | -## Quick Start |
| 3 | +## Local Preview |
6 | 4 |
|
7 | 5 | ```bash |
8 | 6 | cd .github/dashboard |
9 | 7 | npm install |
10 | | -npx tsx src/generate.ts # fetches live data, outputs to site/ |
11 | | -npx serve site -l 8901 # preview at http://localhost:8901 |
12 | | -``` |
13 | | - |
14 | | -## Project Structure |
15 | | - |
16 | | -``` |
17 | | -src/ |
18 | | - config.ts ← declarative dashboard config (pages, sections, metrics) |
19 | | - types.ts ← all TypeScript types |
20 | | - github.ts ← GitHub API client (REST + GraphQL) |
21 | | - compute.ts ← transforms raw data → chart-ready data |
22 | | - render.ts ← generates HTML with Chart.js |
23 | | - generate.ts ← entry point: fetch → compute → render → write |
24 | | -site/ ← generated output (gitignored) |
25 | | -``` |
26 | | - |
27 | | -## Adding a Section |
28 | | - |
29 | | -Edit `src/config.ts`. Each page has a `sections` array. Available section types: |
30 | | - |
31 | | -| Type | Description | Key fields | |
32 | | -| --------------- | ----------------------------------- | -------------------------------- | |
33 | | -| `stats` | Stat cards with time windows | `metrics`, `windows` | |
34 | | -| `timeline` | Weekly bar chart + cumulative line | `series` | |
35 | | -| `distribution` | Doughnut or bar chart | `field`, `chart` | |
36 | | -| `histogram` | Bucketed bar chart | `field`, `buckets`, `groupBy` | |
37 | | -| `table` | Filtered/sorted table | `filter`, `columns`, `limit` | |
38 | | -| `termFrequency` | Word frequency from titles | `field`, `filter`, `minCount` | |
39 | | -| `ci` | CI pass rates, failures, flaky jobs | `workflows`, `branch`, `maxRuns` | |
40 | | - |
41 | | -Example — add a new chart to the PRs page: |
42 | | - |
43 | | -```typescript |
44 | | -{ type: "distribution", field: "author", chart: "bar", orientation: "horizontal" }, |
45 | | -``` |
46 | | - |
47 | | -## Adding a Page |
48 | | - |
49 | | -Add an entry to `config.pages` in `src/config.ts`: |
50 | | - |
51 | | -```typescript |
52 | | -{ |
53 | | - id: "my-page", |
54 | | - title: "My Page", |
55 | | - dataSource: "issues", // "issues" | "prs" | "ci" |
56 | | - sections: [ ... ], |
57 | | -} |
| 8 | +npx tsx src/generate.ts |
| 9 | +npx serve site -l 8901 |
58 | 10 | ``` |
59 | 11 |
|
60 | | -Navigation links are generated automatically. |
| 12 | +For faster iteration, set `maxRuns: 10` in the CI section of `src/config.ts` — full CI fetch takes ~90s. |
61 | 13 |
|
62 | | -## Development Workflow |
| 14 | +## Type Check |
63 | 15 |
|
64 | 16 | ```bash |
65 | | -# Type check |
66 | 17 | npx tsc --noEmit |
67 | | - |
68 | | -# Generate with reduced CI data (faster iteration) |
69 | | -# Set maxRuns to 10 in config.ts, then: |
70 | | -npx tsx src/generate.ts |
71 | | - |
72 | | -# Serve and preview |
73 | | -npx serve site -l 8901 |
74 | 18 | ``` |
75 | | - |
76 | | -Full generation takes ~90s (CI job fetching is the bottleneck). For faster iteration, set `maxRuns: 10` in the CI |
77 | | -section config while developing. |
78 | | - |
79 | | -## Deployment |
80 | | - |
81 | | -Handled automatically by `.github/workflows/dashboard.yml`: |
82 | | - |
83 | | -- Triggers on issue/PR events, daily at 6am UTC, or manual dispatch |
84 | | -- Runs `npm ci && npx tsx src/generate.ts` |
85 | | -- Deploys `site/` to GitHub Pages |
86 | | - |
87 | | -To enable: Settings → Pages → Source → GitHub Actions. |
0 commit comments