Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix: validate display titles and pin contributor card actions
tt-a1ide9a160df043
diff --git a/.github/workflows/contributor-cards.yml b/.github/workflows/contributor-cards.ymlindex ce505089..7497b6b1 100644--- a/.github/workflows/contributor-cards.yml+++ b/.github/workflows/contributor-cards.yml@@ -33,13 +33,13 @@ jobs:runs-on: ubuntu-latesttimeout-minutes: 10steps:- - uses: actions/checkout@v5+ - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5with:persist-credentials: false- - uses: actions/setup-node@v5+ - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5with:node-version: 22- - uses: browser-actions/setup-chrome@v2+ - uses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2id: chromewith:chrome-version: stable@@ -69,14 +69,14 @@ jobs:pull-requests: writesteps:# Privileged runs use only the default branch, never PR head/merge refs.- - uses: actions/checkout@v5+ - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5with:ref: ${{ github.event.repository.default_branch }}persist-credentials: false- - uses: actions/setup-node@v5+ - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5with:node-version: 22- - uses: browser-actions/setup-chrome@v2+ - uses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2id: chromewith:chrome-version: stable@@ -96,7 +96,7 @@ jobs:if [[ "$CARD_PUBLISH" == 'true' ]]; then args+=(--publish); finode tools/contributor-cards/cli.mjs "${args[@]}"- name: Keep downloadable card and rendering evidence- uses: actions/upload-artifact@v4+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4with:name: contributor-card-${{ github.event.pull_request.number || inputs.pr }}path: ${{ runner.temp }}/contributor-card/diff --git a/tools/contributor-cards/README.md b/tools/contributor-cards/README.mdindex 89dc384e..0c76dc4c 100644--- a/tools/contributor-cards/README.md+++ b/tools/contributor-cards/README.md@@ -12,7 +12,7 @@ node tools/contributor-cards/cli.mjs --pr 394 --out /tmp/archify-cardAn optional `--repo owner/repository` selects another repository. On Linux, install `fonts-noto-cjk` for Chinese titles; on macOS the template uses PingFang SC. `ARCHIFY_CHROME` can select a Chrome executable. Preview mode never writes to GitHub.-The output includes the 1000 × 1500 PNG, a portable HTML document with embedded map/fonts, original metadata with a PNG digest, a browser layout receipt, and the proposed reply. Full PR titles remain in metadata and the HTML title attribute. Font size is reduced within a readable range; exceptionally long titles end with an explicit ellipsis. Usernames are fitted without truncation; exceptionally wide 39-character handles wrap to two lines at the minimum 30px size. Middle-dot text separators are not used.+The output includes the 1000 × 1500 PNG, a portable HTML document with embedded map/fonts, original metadata with a PNG digest, a browser layout receipt, and the proposed reply. Original PR titles remain in metadata. The HTML title attribute retains the normalized display text before visual truncation. Titles that normalize to empty text are rejected. Font size is reduced within a readable range; exceptionally long titles end with an explicit ellipsis. Usernames are fitted without truncation; exceptionally wide 39-character handles wrap to two lines at the minimum 30px size. Middle-dot text separators are not used.## Publish and replydiff --git a/tools/contributor-cards/card.mjs b/tools/contributor-cards/card.mjsindex 11ab816b..14a8d79f 100644--- a/tools/contributor-cards/card.mjs+++ b/tools/contributor-cards/card.mjs@@ -15,6 +15,11 @@ export function prNumber(value) {if (!/^[1-9]\d{0,9}$/.test(String(value))) throw new Error('Expected a positive PR number.');return Number(value);}+function displayTitle(title) {+ const normalized = title.replace(/[\u0000-\u001f\u007f\u200e\u200f\u202a-\u202e\u2066-\u2069·•]/g, ' ').replace(/\s+/g, ' ').trim();+ if (!normalized) throw new Error('PR title has no displayable text.');+ return normalized;+}export function recordFromPull(pull, repository) {validRepository(repository);const number = prNumber(pull.number);@@ -23,6 +28,7 @@ export function recordFromPull(pull, repository) {if (!/^[a-f0-9]{40}$/.test(pull.merge_commit_sha || '')) throw new Error('Missing merge commit.');if (pull.user?.type !== 'User' || !/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/.test(pull.user.login || '')) throw new Error('A human GitHub author is required.');if (typeof pull.title !== 'string' || !pull.title.trim() || pull.title.length > 512) throw new Error('Invalid PR title.');+ displayTitle(pull.title);return {templateVersion, repository, number, author: pull.user.login,title: pull.title, mergedAt: pull.merged_at, mergeCommit: pull.merge_commit_sha,@@ -35,7 +41,7 @@ export function escapeHtml(value) {export async function cardHtml(record) {const data = {AUTHOR: record.author, NUMBER: record.number, REPOSITORY: record.repository,- TITLE: record.title.replace(/[\u0000-\u001f\u007f\u200e\u200f\u202a-\u202e\u2066-\u2069·•]/g, ' ').replace(/\s+/g, ' ').trim(),+ TITLE: displayTitle(record.title),DATE: record.mergedAt.slice(0, 10), SHORT_SHA: record.mergeCommit.slice(0, 7),};let html = (await fs.readFile(path.join(root, 'template.html'), 'utf8'))diff --git a/tools/contributor-cards/test/card.test.mjs b/tools/contributor-cards/test/card.test.mjsindex ddcea159..7023b924 100644--- a/tools/contributor-cards/test/card.test.mjs+++ b/tools/contributor-cards/test/card.test.mjs@@ -53,3 +53,11 @@ test('real browser fits long GitHub usernames, long unbroken titles and Chinese}} finally { await fs.rm(output,{recursive:true,force:true}); }});++test('titles that become empty cannot create a blank contribution field', async () => {+ for (const title of ['·', ' • ', '\u202e\u2066', '\u0001 · • \u200f']) {+ assert.throws(() => recordFromPull({...pull, title}, 'tt-a1i/archify'), /no displayable text/);+ const record = recordFromPull(pull, 'tt-a1i/archify');+ await assert.rejects(cardHtml({...record, title}), /no displayable text/);+ }+});diff --git a/tools/contributor-cards/test/workflow.test.mjs b/tools/contributor-cards/test/workflow.test.mjsindex 4763b962..55f2f188 100644--- a/tools/contributor-cards/test/workflow.test.mjs+++ b/tools/contributor-cards/test/workflow.test.mjs@@ -11,6 +11,7 @@ test('privileged automation reads the default branch and does not interpolate PRassert.doesNotMatch(workflow, /pull_request\.head|refs\/pull|pull_request\.merge_commit_sha/);assert.doesNotMatch(workflow, /\$\{\{[^}]*\.(title|body|login)[^}]*\}\}/);assert.match(workflow, /persist-credentials: false/);+ for (const [, ref] of workflow.matchAll(/uses:\s+[^@\s]+@([^\s]+)/g)) assert.match(ref, /^[a-f0-9]{40}$/);assert.match(workflow, /group: contributor-card-\$\{\{ github\.event\.pull_request\.number \|\| inputs\.pr \}\}/);assert.match(workflow, /cancel-in-progress: false/);});