diff --git a/index.ts b/index.ts index 123cd5d..6943129 100644 --- a/index.ts +++ b/index.ts @@ -29,7 +29,7 @@ interface RFC { filename: string; html: string; git: RFCGitInfo; - authors: string[] | null; // parsed from markdown frontmatter, overrides git author + authors: GitHubAuthor[]; // parsed from markdown frontmatter @usernames, or git author fallback } interface ProposedRFC { @@ -37,7 +37,7 @@ interface ProposedRFC { title: string; prNumber: number; prUrl: string; - author: GitHubAuthor | null; + authors: GitHubAuthor[]; } const THEME_SCRIPT = ` @@ -151,19 +151,14 @@ function indexPage( .map((rfc) => { const dateStr = rfc.git.accepted ? formatDate(rfc.git.accepted.date) : ""; - let authorHTML = ""; - if (rfc.authors) { - authorHTML = `${rfc.authors.map(escapeHTML).join(", ")}`; - } else if (rfc.git.author && rfc.git.accepted) { - const commitUrl = repoUrl - ? `${repoUrl}/commit/${rfc.git.accepted.hash}` - : `https://github.com/${rfc.git.author.login}`; - authorHTML = ` - - ${rfc.git.author.login} - ${rfc.git.author.login} - `; - } + const authorHTML = rfc.authors + .map( + (author) => ` + + ${author.login} + `, + ) + .join(""); return `
  • @@ -180,14 +175,14 @@ function indexPage( if (proposed.length > 0) { const proposedList = proposed .map((rfc) => { - let authorHTML = ""; - if (rfc.author) { - authorHTML = ` - - ${rfc.author.login} - ${rfc.author.login} - `; - } + const authorHTML = rfc.authors + .map( + (author) => ` + + ${author.login} + `, + ) + .join(""); return `
  • @@ -238,20 +233,20 @@ function rfcPage( Accepted `; - if (rfc.git.accepted || rfc.git.author || rfc.authors) { - // Author section - if (rfc.authors) { + if (rfc.git.accepted || rfc.authors.length > 0) { + if (rfc.authors.length > 0) { + const authorsHTML = rfc.authors + .map( + (author) => ` + + ${author.login} + ${author.login} + `, + ) + .join(", "); gitHeader += `
    - ${rfc.authors.map(escapeHTML).join(", ")} -
    `; - } else if (rfc.git.author) { - gitHeader += ` -
    - - ${rfc.git.author.login} - ${rfc.git.author.login} - + ${authorsHTML}
    `; } @@ -422,17 +417,24 @@ async function validateProposals(): Promise { return errors; } -function parseAuthors(markdown: string): string[] | null { - // Match "- Authors: Name1, Name2" or "**Authors:** Name1, Name2" +function parseAuthorLogins(markdown: string): string[] { + // Match "- Authors: @user1, @user2" or "**Authors:** @user1, @user2" const match = markdown.match( /^(?:-\s*Authors:\s*|\*\*Authors:\*\*\s*)(.+)$/im, ); - if (!match?.[1]) return null; - const authors = match[1] + if (!match?.[1]) return []; + return match[1] .split(",") - .map((a) => a.trim()) + .map((a) => a.trim().replace(/^@/, "")) .filter(Boolean); - return authors.length > 0 ? authors : null; +} + +function loginsToAuthors(logins: string[]): GitHubAuthor[] { + return logins.map((login) => ({ + login, + avatarUrl: `https://github.com/${login}.png?size=48`, + profileUrl: `https://github.com/${login}`, + })); } function parseTitle(markdown: string, filename: string): string { @@ -510,7 +512,7 @@ async function getProposedRFCs( if (!repoPath) return []; try { const result = - await $`gh pr list --repo ${repoPath} --state open --json number,title,url,files,author`.quiet(); + await $`gh pr list --repo ${repoPath} --state open --json number,title,url,files,author,headRefName`.quiet(); const prs = JSON.parse(result.stdout.toString()); const proposed: ProposedRFC[] = []; @@ -527,18 +529,30 @@ async function getProposedRFCs( const rfcNumber = rfcFile.path.match(/(\d{4})-/)?.[1]; if (!rfcNumber) continue; + // Fetch file content from PR branch to parse authors + let authors: GitHubAuthor[] = []; + try { + const fileResult = + await $`gh api repos/${repoPath}/contents/${rfcFile.path}?ref=${pr.headRefName} --jq '.content'`.quiet(); + const content = atob(fileResult.stdout.toString().trim()); + const logins = parseAuthorLogins(content); + if (logins.length > 0) { + authors = loginsToAuthors(logins); + } + } catch { + // Fall back to PR author + } + + if (authors.length === 0 && pr.author) { + authors = loginsToAuthors([pr.author.login]); + } + proposed.push({ number: rfcNumber, title: pr.title, prNumber: pr.number, prUrl: pr.url, - author: pr.author - ? { - login: pr.author.login, - avatarUrl: `https://github.com/${pr.author.login}.png?size=48`, - profileUrl: `https://github.com/${pr.author.login}`, - } - : null, + authors, }); } @@ -579,8 +593,14 @@ async function build(liveReload: boolean = false): Promise { const html = await highlightCodeBlocks(rawHtml); const number = parseRFCNumber(filename); const title = parseTitle(content, filename); - const authors = parseAuthors(content); + const authorLogins = parseAuthorLogins(content); const git = await getGitHistory(path, repoPath); + const authors = + authorLogins.length > 0 + ? loginsToAuthors(authorLogins) + : git.author + ? [git.author] + : []; rfcs.push({ number, title, filename, html, git, authors }); } @@ -738,8 +758,14 @@ async function buildPreview(): Promise { const html = await highlightCodeBlocks(rawHtml); const number = parseRFCNumber(filename); const title = parseTitle(content, filename); - const authors = parseAuthors(content); + const authorLogins = parseAuthorLogins(content); const git = await getGitHistory(path, repoPath); + const authors = + authorLogins.length > 0 + ? loginsToAuthors(authorLogins) + : git.author + ? [git.author] + : []; rfcs.push({ number, title, filename, html, git, authors }); } diff --git a/rfcs/0000-template.md b/rfcs/0000-template.md index da18b0c..f719fd3 100644 --- a/rfcs/0000-template.md +++ b/rfcs/0000-template.md @@ -1,5 +1,5 @@ - Start Date: YYYY-MM-DD (today's date) -- Authors: John Smith, Foo Bar +- Authors: @username1, @username2 - RFC PR: [vortex-data/rfcs#0000](https://github.com/vortex-data/rfcs/pull/0000) # RFC Template diff --git a/rfcs/0015-variant-type.md b/rfcs/0015-variant-type.md index a6dfd13..0bd7ba1 100644 --- a/rfcs/0015-variant-type.md +++ b/rfcs/0015-variant-type.md @@ -1,5 +1,5 @@ - Start Date: 2025-02-25 -- Authors: Adam Gutglick +- Authors: @AdamGS - RFC PR: [vortex-data/rfcs#15](https://github.com/vortex-data/rfcs/pull/15) # Variant Type diff --git a/rfcs/0024-tensor.md b/rfcs/0024-tensor.md index c2ca126..c318c4a 100644 --- a/rfcs/0024-tensor.md +++ b/rfcs/0024-tensor.md @@ -1,5 +1,5 @@ - Start Date: 2026-03-04 -- Authors: Connor Tsui +- Authors: @connortsui20 - RFC PR: [vortex-data/rfcs#24](https://github.com/vortex-data/rfcs/pull/24) # Fixed-shape Tensor Extension diff --git a/rfcs/0027-patches-format.md b/rfcs/0027-patches-format.md index 1beb1e6..2b22020 100644 --- a/rfcs/0027-patches-format.md +++ b/rfcs/0027-patches-format.md @@ -1,4 +1,5 @@ - Start Date: 2026-03-02 +- Authors: @a10y - Tracking Issue: TBD - Draft PR: https://github.com/vortex-data/vortex/pull/6815