From 3f7cb97dcd1e0448ffc1db9cf49adefe8ae35349 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Mon, 23 Feb 2026 14:14:04 -0500 Subject: [PATCH 1/3] debug logging Signed-off-by: Andrew Duffy --- index.ts | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 43d614d..cceb4d5 100644 --- a/index.ts +++ b/index.ts @@ -221,30 +221,45 @@ async function getGitHubRepoUrl(): Promise { } async function getGitHubAuthor(repoPath: string, commitHash: string): Promise { + console.log(`[DEBUG] getGitHubAuthor called with repoPath=${repoPath}, commitHash=${commitHash}`); try { // Use gh CLI to fetch commit info from GitHub API + const cmd = `gh api repos/${repoPath}/commits/${commitHash} --jq '.author.login, .author.avatar_url, .author.html_url'`; + console.log(`[DEBUG] Running command: ${cmd}`); const result = await $`gh api repos/${repoPath}/commits/${commitHash} --jq '.author.login, .author.avatar_url, .author.html_url'`.quiet(); - const lines = result.stdout.toString().trim().split("\n"); + const stdout = result.stdout.toString(); + const stderr = result.stderr.toString(); + console.log(`[DEBUG] gh api stdout: ${stdout}`); + console.log(`[DEBUG] gh api stderr: ${stderr}`); + const lines = stdout.trim().split("\n"); + console.log(`[DEBUG] Parsed lines: ${JSON.stringify(lines)}`); if (lines.length >= 3 && lines[0] && lines[1] && lines[2]) { - return { + const author = { login: lines[0], avatarUrl: lines[1], profileUrl: lines[2], }; + console.log(`[DEBUG] Returning author: ${JSON.stringify(author)}`); + return author; } + console.log(`[DEBUG] Not enough lines or empty values, returning null`); return null; - } catch { + } catch (error) { + console.log(`[DEBUG] getGitHubAuthor error: ${error}`); return null; } } async function getGitHistory(filepath: string, repoPath: string | null): Promise { + console.log(`[DEBUG] getGitHistory called with filepath=${filepath}, repoPath=${repoPath}`); try { const result = await $`git log --follow --format=%H\ %aI -- ${filepath}`.quiet(); const lines = result.stdout.toString().trim().split("\n").filter(Boolean); + console.log(`[DEBUG] git log returned ${lines.length} commits`); if (lines.length === 0) { + console.log(`[DEBUG] No commits found, returning nulls`); return { accepted: null, lastUpdated: null, author: null }; } @@ -257,9 +272,11 @@ async function getGitHistory(filepath: string, repoPath: string | null): Promise const mostRecent = parseCommit(lines[0]!); const oldest = parseCommit(lines[lines.length - 1]!); + console.log(`[DEBUG] oldest commit hash: ${oldest.hash}`); // Fetch author info from the first commit const author = repoPath ? await getGitHubAuthor(repoPath, oldest.hash) : null; + console.log(`[DEBUG] author result: ${JSON.stringify(author)}`); // If only one commit, or same commit, don't show lastUpdated if (lines.length === 1 || mostRecent.hash === oldest.hash) { @@ -337,6 +354,7 @@ async function build(liveReload: boolean = false): Promise { const repoUrl = await getGitHubRepoUrl(); // Extract repo path (e.g., "vortex-data/rfcs") for API calls const repoPath = repoUrl ? repoUrl.replace("https://github.com/", "") : null; + console.log(`[DEBUG] repoUrl=${repoUrl}, repoPath=${repoPath}`); const glob = new Bun.Glob("*.md"); const rfcs: RFC[] = []; From 502126b98e9e05375417733fe1657064db77cf2f Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Mon, 23 Feb 2026 14:16:32 -0500 Subject: [PATCH 2/3] add token Signed-off-by: Andrew Duffy --- .github/workflows/ci.yml | 2 ++ .github/workflows/deploy.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98d0878..5927c34 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,8 @@ on: jobs: build: + env: + GH_TOKEN: ${{ github.token }} runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f8bc9c3..5b31b10 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,6 +16,8 @@ concurrency: jobs: build: + env: + GH_TOKEN: ${{ github.token }} runs-on: ubuntu-latest steps: - name: Checkout From 6dd5b365c86fe7e5dd44054c271d704adc988e17 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Mon, 23 Feb 2026 14:17:12 -0500 Subject: [PATCH 3/3] Revert "debug logging" This reverts commit 3f7cb97dcd1e0448ffc1db9cf49adefe8ae35349. Signed-off-by: Andrew Duffy --- index.ts | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/index.ts b/index.ts index cceb4d5..43d614d 100644 --- a/index.ts +++ b/index.ts @@ -221,45 +221,30 @@ async function getGitHubRepoUrl(): Promise { } async function getGitHubAuthor(repoPath: string, commitHash: string): Promise { - console.log(`[DEBUG] getGitHubAuthor called with repoPath=${repoPath}, commitHash=${commitHash}`); try { // Use gh CLI to fetch commit info from GitHub API - const cmd = `gh api repos/${repoPath}/commits/${commitHash} --jq '.author.login, .author.avatar_url, .author.html_url'`; - console.log(`[DEBUG] Running command: ${cmd}`); const result = await $`gh api repos/${repoPath}/commits/${commitHash} --jq '.author.login, .author.avatar_url, .author.html_url'`.quiet(); - const stdout = result.stdout.toString(); - const stderr = result.stderr.toString(); - console.log(`[DEBUG] gh api stdout: ${stdout}`); - console.log(`[DEBUG] gh api stderr: ${stderr}`); - const lines = stdout.trim().split("\n"); - console.log(`[DEBUG] Parsed lines: ${JSON.stringify(lines)}`); + const lines = result.stdout.toString().trim().split("\n"); if (lines.length >= 3 && lines[0] && lines[1] && lines[2]) { - const author = { + return { login: lines[0], avatarUrl: lines[1], profileUrl: lines[2], }; - console.log(`[DEBUG] Returning author: ${JSON.stringify(author)}`); - return author; } - console.log(`[DEBUG] Not enough lines or empty values, returning null`); return null; - } catch (error) { - console.log(`[DEBUG] getGitHubAuthor error: ${error}`); + } catch { return null; } } async function getGitHistory(filepath: string, repoPath: string | null): Promise { - console.log(`[DEBUG] getGitHistory called with filepath=${filepath}, repoPath=${repoPath}`); try { const result = await $`git log --follow --format=%H\ %aI -- ${filepath}`.quiet(); const lines = result.stdout.toString().trim().split("\n").filter(Boolean); - console.log(`[DEBUG] git log returned ${lines.length} commits`); if (lines.length === 0) { - console.log(`[DEBUG] No commits found, returning nulls`); return { accepted: null, lastUpdated: null, author: null }; } @@ -272,11 +257,9 @@ async function getGitHistory(filepath: string, repoPath: string | null): Promise const mostRecent = parseCommit(lines[0]!); const oldest = parseCommit(lines[lines.length - 1]!); - console.log(`[DEBUG] oldest commit hash: ${oldest.hash}`); // Fetch author info from the first commit const author = repoPath ? await getGitHubAuthor(repoPath, oldest.hash) : null; - console.log(`[DEBUG] author result: ${JSON.stringify(author)}`); // If only one commit, or same commit, don't show lastUpdated if (lines.length === 1 || mostRecent.hash === oldest.hash) { @@ -354,7 +337,6 @@ async function build(liveReload: boolean = false): Promise { const repoUrl = await getGitHubRepoUrl(); // Extract repo path (e.g., "vortex-data/rfcs") for API calls const repoPath = repoUrl ? repoUrl.replace("https://github.com/", "") : null; - console.log(`[DEBUG] repoUrl=${repoUrl}, repoPath=${repoPath}`); const glob = new Bun.Glob("*.md"); const rfcs: RFC[] = [];