From 4cb20d6f54f09013d045a78514cc24024ee8ee45 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Thu, 19 Mar 2026 15:05:19 +1100 Subject: [PATCH 1/5] feat: use PR title for current node in render --- .editorconfig-checker | 1 - .eslintrc.cjs | 10 +++++++++- dist/index.js | 14 +++++++++----- src/inputs.test.ts | 2 ++ src/inputs.ts | 1 + src/renderer.test.ts | 4 +++- src/renderer.ts | 13 ++++++++----- src/types.ts | 1 + tsconfig.json | 4 ++-- vitest.config.ts | 7 +++++++ vitest.setup.ts | 17 +++++++++++++++++ 11 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 vitest.config.ts create mode 100644 vitest.setup.ts diff --git a/.editorconfig-checker b/.editorconfig-checker index ffb46fb..883c76b 100644 --- a/.editorconfig-checker +++ b/.editorconfig-checker @@ -1,5 +1,4 @@ { - "Version": "v3.4.1", "Verbose": false, "Debug": false, "IgnoreDefaults": false, diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 98d1a9f..4bb3e68 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -34,5 +34,13 @@ module.exports = { '@typescript-eslint/array-type': ['error', { default: 'array-simple' }], '@typescript-eslint/require-await': 'off', 'import/no-extraneous-dependencies': 'off' - } + }, + overrides: [ + { + files: ['**/*.config.*'], + rules: { + 'import/no-default-export': 'off', + }, + }, + ], }; diff --git a/dist/index.js b/dist/index.js index 27bd9c1..b562a90 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42769,10 +42769,12 @@ function renderVisualization(graph, terminatingRefs) { line += `- \`${stackNode.ref}\``; } if (stackNode.type === "pull-request") { - line += `- #${stackNode.number}`; - } - if (stackNode.isCurrent) { - line += " :point_left:"; + if (stackNode.isCurrent) { + line += `- ${stackNode.title}`; + line += " :point_left:"; + } else { + line += `- #${stackNode.number}`; + } } if (depth === 0) { line += ` ${ANCHOR}`; @@ -46891,7 +46893,8 @@ var pullRequestSchema = objectType({ ref: stringType() }), state: stringType(), - body: stringType().optional().nullable() + body: stringType().optional().nullable(), + title: stringType() }); // src/locations/types.ts @@ -47012,6 +47015,7 @@ var inputs = { base: { ref: item.base.ref }, head: { ref: item.head.ref }, body: item.body ?? void 0, + title: item.title, state: item.state }; } diff --git a/src/inputs.test.ts b/src/inputs.test.ts index 2a38d4b..36ec875 100644 --- a/src/inputs.test.ts +++ b/src/inputs.test.ts @@ -136,6 +136,7 @@ describe('getCurrentPullRequest', () => { number: 100, base: { ref: 'main' }, head: { ref: 'feat/git-town-action' }, + title: 'feat: git town action', state: 'open', }, }, @@ -147,6 +148,7 @@ describe('getCurrentPullRequest', () => { number: 100, base: { ref: 'main' }, head: { ref: 'feat/git-town-action' }, + title: 'feat: git town action', state: 'open', }) }) diff --git a/src/inputs.ts b/src/inputs.ts index f1b0b14..cdd5ff8 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -161,6 +161,7 @@ export const inputs = { base: { ref: item.base.ref }, head: { ref: item.head.ref }, body: item.body ?? undefined, + title: item.title, state: item.state, } } diff --git a/src/renderer.test.ts b/src/renderer.test.ts index 4feedeb..ce791ca 100644 --- a/src/renderer.test.ts +++ b/src/renderer.test.ts @@ -16,6 +16,7 @@ describe('getOutput', () => { }, state: 'TODO', body: 'pr 1 body', + title: 'feat: implement feature 1', } const pullRequest2: PullRequest = { number: 2, @@ -27,6 +28,7 @@ describe('getOutput', () => { }, state: 'TODO', body: 'pr 2 body', + title: 'feat: implement feature 2', } const repoGraph = new DirectedGraph() repoGraph.mergeNode('main', { type: 'perennial', ref: 'main' }) @@ -46,7 +48,7 @@ describe('getOutput', () => { const visualization = renderVisualization(stackGraph, ['main']) const expected = [ '- `main` ', - ' - #1 :point_left:', + ' - feat: implement feature 1 :point_left:', ' - #2', ].join('\n') diff --git a/src/renderer.ts b/src/renderer.ts index 3eb352a..23b727b 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -44,13 +44,16 @@ export function renderVisualization( } if (stackNode.type === 'pull-request') { - line += `- #${stackNode.number}` - } - - if (stackNode.isCurrent) { - line += ' :point_left:' + if (stackNode.isCurrent) { + line += `- ${stackNode.title}` + line += ' :point_left:' + } else { + line += `- #${stackNode.number}` + } } + // Attach anchor tag to root of visualization to enable subsequent runs to locate + // visualization directly if (depth === 0) { line += ` ${ANCHOR}` } diff --git a/src/types.ts b/src/types.ts index 5341aad..bb25cf4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -15,6 +15,7 @@ export const pullRequestSchema = object({ }), state: string(), body: string().optional().nullable(), + title: string(), }) export type PullRequest = InferType diff --git a/tsconfig.json b/tsconfig.json index 25c3d5f..0f50446 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "rootDir": "src", + "rootDir": ".", "outDir": "dist", "forceConsistentCasingInFileNames": true, "isolatedModules": true, @@ -21,6 +21,6 @@ "noUnusedLocals": true, "noUnusedParameters": true }, - "include": ["."], + "include": ["src", "vitest.config.ts", "vitest.setup.ts"], "exclude": ["node_modules", "dist"] } diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..32b5adc --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + setupFiles: ['vitest.setup.ts'], + }, +}) diff --git a/vitest.setup.ts b/vitest.setup.ts new file mode 100644 index 0000000..cd347f5 --- /dev/null +++ b/vitest.setup.ts @@ -0,0 +1,17 @@ +import { beforeAll, vi } from 'vitest' + +beforeAll(() => { + vi.mock('@actions/core', async () => { + const core = await import('@actions/core') + + return { + ...core, + startGroup: () => undefined, + endGroup: () => undefined, + debug: () => undefined, + info: () => undefined, + error: () => undefined, + setFailed: () => undefined, + } satisfies typeof core + }) +}) From 062e56ebea058e719bc06905e469ca2be7f048d5 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Thu, 19 Mar 2026 15:10:13 +1100 Subject: [PATCH 2/5] update node version --- .node-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.node-version b/.node-version index 7cc2069..7c974b0 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.5.1 +24.1.0 From 995957fab50014cb89b743543b3524951a1fd255 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Thu, 19 Mar 2026 15:11:37 +1100 Subject: [PATCH 3/5] bold title text --- dist/index.js | 2 +- src/renderer.test.ts | 2 +- src/renderer.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index b562a90..8aef1a7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42770,7 +42770,7 @@ function renderVisualization(graph, terminatingRefs) { } if (stackNode.type === "pull-request") { if (stackNode.isCurrent) { - line += `- ${stackNode.title}`; + line += `- **${stackNode.title}**`; line += " :point_left:"; } else { line += `- #${stackNode.number}`; diff --git a/src/renderer.test.ts b/src/renderer.test.ts index ce791ca..a9f9f54 100644 --- a/src/renderer.test.ts +++ b/src/renderer.test.ts @@ -48,7 +48,7 @@ describe('getOutput', () => { const visualization = renderVisualization(stackGraph, ['main']) const expected = [ '- `main` ', - ' - feat: implement feature 1 :point_left:', + ' - **feat: implement feature 1** :point_left:', ' - #2', ].join('\n') diff --git a/src/renderer.ts b/src/renderer.ts index 23b727b..6a9e464 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -45,7 +45,7 @@ export function renderVisualization( if (stackNode.type === 'pull-request') { if (stackNode.isCurrent) { - line += `- ${stackNode.title}` + line += `- **${stackNode.title}**` line += ' :point_left:' } else { line += `- #${stackNode.number}` From d9d684e66a3ab4bc28d8c50bc00fafd85b5ff951 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Thu, 19 Mar 2026 15:19:48 +1100 Subject: [PATCH 4/5] include PR number --- .github/workflows/git-town.yml | 2 +- dist/index.js | 2 +- src/renderer.test.ts | 2 +- src/renderer.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/git-town.yml b/.github/workflows/git-town.yml index 85105ad..e2610b6 100644 --- a/.github/workflows/git-town.yml +++ b/.github/workflows/git-town.yml @@ -3,7 +3,7 @@ name: Git Town on: pull_request: branches: - - '**' + - "**" concurrency: group: git-town-${{ github.sha }} diff --git a/dist/index.js b/dist/index.js index 8aef1a7..9aae308 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42770,7 +42770,7 @@ function renderVisualization(graph, terminatingRefs) { } if (stackNode.type === "pull-request") { if (stackNode.isCurrent) { - line += `- **${stackNode.title}**`; + line += `- **${stackNode.title} \\#${stackNode.number}**`; line += " :point_left:"; } else { line += `- #${stackNode.number}`; diff --git a/src/renderer.test.ts b/src/renderer.test.ts index a9f9f54..a850021 100644 --- a/src/renderer.test.ts +++ b/src/renderer.test.ts @@ -48,7 +48,7 @@ describe('getOutput', () => { const visualization = renderVisualization(stackGraph, ['main']) const expected = [ '- `main` ', - ' - **feat: implement feature 1** :point_left:', + ' - **feat: implement feature 1 \\#1** :point_left:', ' - #2', ].join('\n') diff --git a/src/renderer.ts b/src/renderer.ts index 6a9e464..55e967f 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -45,7 +45,7 @@ export function renderVisualization( if (stackNode.type === 'pull-request') { if (stackNode.isCurrent) { - line += `- **${stackNode.title}**` + line += `- **${stackNode.title} \\#${stackNode.number}**` line += ' :point_left:' } else { line += `- #${stackNode.number}` From eef725f1d0aef43fef186894c59b1c8172713e26 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Thu, 19 Mar 2026 15:21:07 +1100 Subject: [PATCH 5/5] yeah that didn't work --- dist/index.js | 2 +- src/renderer.test.ts | 2 +- src/renderer.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9aae308..8aef1a7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42770,7 +42770,7 @@ function renderVisualization(graph, terminatingRefs) { } if (stackNode.type === "pull-request") { if (stackNode.isCurrent) { - line += `- **${stackNode.title} \\#${stackNode.number}**`; + line += `- **${stackNode.title}**`; line += " :point_left:"; } else { line += `- #${stackNode.number}`; diff --git a/src/renderer.test.ts b/src/renderer.test.ts index a850021..a9f9f54 100644 --- a/src/renderer.test.ts +++ b/src/renderer.test.ts @@ -48,7 +48,7 @@ describe('getOutput', () => { const visualization = renderVisualization(stackGraph, ['main']) const expected = [ '- `main` ', - ' - **feat: implement feature 1 \\#1** :point_left:', + ' - **feat: implement feature 1** :point_left:', ' - #2', ].join('\n') diff --git a/src/renderer.ts b/src/renderer.ts index 55e967f..6a9e464 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -45,7 +45,7 @@ export function renderVisualization( if (stackNode.type === 'pull-request') { if (stackNode.isCurrent) { - line += `- **${stackNode.title} \\#${stackNode.number}**` + line += `- **${stackNode.title}**` line += ' :point_left:' } else { line += `- #${stackNode.number}`