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/.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/.node-version b/.node-version index 7cc2069..7c974b0 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -20.5.1 +24.1.0 diff --git a/dist/index.js b/dist/index.js index 27bd9c1..8aef1a7 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..a9f9f54 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..6a9e464 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 + }) +})