diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000000..87cc2c8c5d --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,55 @@ +name: Deploy triage site to Pages + +on: + pull_request: + paths: + - "site/**" + - ".github/workflows/pages.yml" + push: + branches: [main] + paths: + - "site/**" + - ".github/workflows/pages.yml" + workflow_dispatch: + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build: + permissions: + contents: read + runs-on: ubuntu-latest + defaults: + run: + working-directory: site + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: site/package-lock.json + - run: npm ci + - run: npm test + - run: npm run lint + - run: npm run build + - uses: actions/upload-pages-artifact@v3 + with: + path: site/dist + + deploy: + if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/site/.gitignore b/site/.gitignore new file mode 100644 index 0000000000..5a86d2a8ae --- /dev/null +++ b/site/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +build/ +dist/ +coverage/ +.DS_Store +*.log +.env* +!.env.example diff --git a/site/README.md b/site/README.md new file mode 100644 index 0000000000..f6bd78c52f --- /dev/null +++ b/site/README.md @@ -0,0 +1,19 @@ +# XCL triage dashboard + +RepoPulse is a browser-only dashboard for the public issues, pull requests, commits, and the +maintained triage digest in [xcl-dev/xcl#1607](https://github.com/xcl-dev/xcl/issues/1607). +It stores personal pins, notes, and triage status only in the visitor's browser. It never asks for +or embeds a GitHub token. + +## Run Locally + +**Prerequisites:** Node.js + + +1. `npm ci` +2. `npm test` +3. `npm run lint` +4. `npm run dev` + +Production builds use `npm run build`. Vite emits `dist/` with the `/xcl/triage/` base path required +by the project Pages URL. The repository workflow publishes that artifact after a push to `main`. diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000000..05fc848e52 --- /dev/null +++ b/site/index.html @@ -0,0 +1,29 @@ + + +
+ + ++ Latest {commits.length} commits in {repoSlug}. Click any linked PR number to inspect it. +
++ No commits match that filter. +
+| SHA | +Message | +Author | +Time | +Link | +
|---|---|---|---|---|
| + + + {commit.shortSha} + + | +
+
+ {commit.messageHeadline}
+
+ {commit.linkedPrNumber !== null && (
+
+
+
+ )}
+ |
+
+
+ |
+ + {formatRelativeTime(commit.date)} + | ++ + Diff + + + | +
+ RepoPulse runs completely in the browser with no backend server required, so you can host it directly on your GitHub Pages website. +
+ +
+ your-name/repopulse
+ {' '}
+ or{' '}
+
+ your-name.github.io
+
+ ).
+
+ .github/workflows/deploy-pages.yml
+ {' '}
+ workflow builds{' '}
+
+ dist/
+ {' '}
+ with relative paths and publishes automatically on every push to{' '}
+
+ main
+
+ .
+ + All triage statuses, pins, and notes are stored in your browser's local storage, and live repository updates sync directly from GitHub's public REST API. +
++ No {mode === 'pr' ? 'pull requests' : 'issues'} match the current filters. +
++ Try switching the state filter to All or clearing your subsystem and text filters. +
+ {hasActiveFilter && ( + + )} +
+ {token.slice(1, -1)}
+
+ );
+ } else if (token.startsWith('[')) {
+ const linkMatch = token.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
+ if (linkMatch && /^https?:\/\//i.test(linkMatch[2])) {
+ const cleanLabel = linkMatch[1].replace(/`/g, '');
+ parts.push(
+
+ {cleanLabel}
+
+ );
+ } else {
+ parts.push(token);
+ }
+ } else if (token.startsWith('http://') || token.startsWith('https://')) {
+ parts.push(
+
+ {token}
+
+ );
+ } else {
+ parts.push(
+
+ {token}
+
+ );
+ }
+ lastIndex = match.index + token.length;
+ }
+
+ if (lastIndex < text.length) {
+ parts.push(text.slice(lastIndex));
+ }
+
+ return parts;
+}
+
+function isTableDivider(line: string): boolean {
+ return /^\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)+\|?$/.test(line.trim());
+}
+
+function parseTableRow(line: string): string[] {
+ return line
+ .trim()
+ .replace(/^\|/, '')
+ .replace(/\|$/, '')
+ .split('|')
+ .map((cell) => cell.trim());
+}
+
+export function MarkdownLite({ content }: MarkdownLiteProps) {
+ if (!content.trim()) {
+ return (
+ + No description provided. +
+ ); + } + + const lines = content.replace(/\r\n/g, '\n').split('\n'); + const blocks: React.ReactNode[] = []; + let i = 0; + + while (i < lines.length) { + const line = lines[i]; + + if (line.trim().startsWith('```')) { + const codeLines: string[] = []; + i += 1; + while (i < lines.length && !lines[i].trim().startsWith('```')) { + codeLines.push(lines[i]); + i += 1; + } + blocks.push( +
+ {codeLines.join('\n')}
+
+ );
+ i += 1;
+ continue;
+ }
+
+ // Markdown pipe table
+ if (
+ line.includes('|') &&
+ i + 1 < lines.length &&
+ isTableDivider(lines[i + 1])
+ ) {
+ const headers = parseTableRow(line);
+ i += 2;
+ const rows: string[][] = [];
+ while (i < lines.length && lines[i].includes('|') && lines[i].trim().length > 0) {
+ rows.push(parseTableRow(lines[i]));
+ i += 1;
+ }
+ blocks.push(
+ | + {renderInline(h)} + | + ))} +
|---|
| + {renderInline(row[cIdx] ?? '')} + | + ))} +
+ {renderInline(line.replace(/^>\s?/, ''))} ++ ); + i += 1; + continue; + } + + if (!line.trim()) { + i += 1; + continue; + } + + blocks.push( +
+ {renderInline(line)} +
+ ); + i += 1; + } + + return+ Prepare a structured report and open it pre-filled on GitHub. +
++ {error} +
+ )} ++ Saved locally in your browser so fast-moving issues and PRs never get lost. +
++ Your triage queue is empty +
++ Open any issue or pull request and assign a triage status, pin it, or add a note to track it here. +
++ Note: {rec.note} +
+ )} ++ {validationError} +
+ )} ++ Loading xcl-dev/xcl#1607 PR triage board... +
++ Could not load #1607 triage digest +
+ ++ Tracking {digest.totalOpenPrs.toLocaleString('en-US')} open PRs ({digest.readyPrs} ready for test verification). Every report must name the PR's current 7-character head commit SHA. +
++ Highest-leverage queue: each PR below already has 1 independent test report on its current head. Click any PR number to load its live head commit SHA and draft the 2nd report. +
+ {filteredOneMore.length === 0 ? ( ++ No PR numbers match “{search}”. +
+ ) : ( ++ Oldest ready PRs with 0 test reports on their current head ({digest.earlierHeadReports} of {digest.zeroReports} total have reports on an earlier head). +
+ {filteredZeroReport.length === 0 ? ( ++ No PR numbers match “{search}”. +
+ ) : ( ++ No ready PRs match “{search}”. +
+ ) : ( + filteredReadyRows.map((row) => { + const active = selectedPrNumber === row.number; + return ( + + ); + }) + )} ++ No duplicate or batch groups match the current filter. +
+ ) : ( + filteredGroups.map((group) => { + const active = selectedGroup?.unit === group.unit; + const statusLabel = + group.status === 'waiting_second' + ? 'Needs 2nd check' + : group.status === 'disagree' + ? 'Checks disagree' + : group.status === 'done' + ? 'Done / retired' + : 'Checked by 2'; + return ( ++ {group.summary} +
+ )} + + {group.checkedBy && ( ++ {group.status === 'waiting_second' ? '1st check: ' : 'Checked by: '} + {group.checkedBy} +
+ )} +