Skip to content

Commit 670e1f4

Browse files
authored
feat: use PR title for current node in render (#73)
1 parent e483957 commit 670e1f4

13 files changed

Lines changed: 61 additions & 17 deletions

.editorconfig-checker

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"Version": "v3.4.1",
32
"Verbose": false,
43
"Debug": false,
54
"IgnoreDefaults": false,

.eslintrc.cjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,13 @@ module.exports = {
3434
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
3535
'@typescript-eslint/require-await': 'off',
3636
'import/no-extraneous-dependencies': 'off'
37-
}
37+
},
38+
overrides: [
39+
{
40+
files: ['**/*.config.*'],
41+
rules: {
42+
'import/no-default-export': 'off',
43+
},
44+
},
45+
],
3846
};

.github/workflows/git-town.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Git Town
33
on:
44
pull_request:
55
branches:
6-
- '**'
6+
- "**"
77

88
concurrency:
99
group: git-town-${{ github.sha }}

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.5.1
1+
24.1.0

dist/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42769,10 +42769,12 @@ function renderVisualization(graph, terminatingRefs) {
4276942769
line += `- \`${stackNode.ref}\``;
4277042770
}
4277142771
if (stackNode.type === "pull-request") {
42772-
line += `- #${stackNode.number}`;
42773-
}
42774-
if (stackNode.isCurrent) {
42775-
line += " :point_left:";
42772+
if (stackNode.isCurrent) {
42773+
line += `- **${stackNode.title}**`;
42774+
line += " :point_left:";
42775+
} else {
42776+
line += `- #${stackNode.number}`;
42777+
}
4277642778
}
4277742779
if (depth === 0) {
4277842780
line += ` ${ANCHOR}`;
@@ -46891,7 +46893,8 @@ var pullRequestSchema = objectType({
4689146893
ref: stringType()
4689246894
}),
4689346895
state: stringType(),
46894-
body: stringType().optional().nullable()
46896+
body: stringType().optional().nullable(),
46897+
title: stringType()
4689546898
});
4689646899

4689746900
// src/locations/types.ts
@@ -47012,6 +47015,7 @@ var inputs = {
4701247015
base: { ref: item.base.ref },
4701347016
head: { ref: item.head.ref },
4701447017
body: item.body ?? void 0,
47018+
title: item.title,
4701547019
state: item.state
4701647020
};
4701747021
}

src/inputs.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ describe('getCurrentPullRequest', () => {
136136
number: 100,
137137
base: { ref: 'main' },
138138
head: { ref: 'feat/git-town-action' },
139+
title: 'feat: git town action',
139140
state: 'open',
140141
},
141142
},
@@ -147,6 +148,7 @@ describe('getCurrentPullRequest', () => {
147148
number: 100,
148149
base: { ref: 'main' },
149150
head: { ref: 'feat/git-town-action' },
151+
title: 'feat: git town action',
150152
state: 'open',
151153
})
152154
})

src/inputs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export const inputs = {
161161
base: { ref: item.base.ref },
162162
head: { ref: item.head.ref },
163163
body: item.body ?? undefined,
164+
title: item.title,
164165
state: item.state,
165166
}
166167
}

src/renderer.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('getOutput', () => {
1616
},
1717
state: 'TODO',
1818
body: 'pr 1 body',
19+
title: 'feat: implement feature 1',
1920
}
2021
const pullRequest2: PullRequest = {
2122
number: 2,
@@ -27,6 +28,7 @@ describe('getOutput', () => {
2728
},
2829
state: 'TODO',
2930
body: 'pr 2 body',
31+
title: 'feat: implement feature 2',
3032
}
3133
const repoGraph = new DirectedGraph<StackNodeAttributes>()
3234
repoGraph.mergeNode('main', { type: 'perennial', ref: 'main' })
@@ -46,7 +48,7 @@ describe('getOutput', () => {
4648
const visualization = renderVisualization(stackGraph, ['main'])
4749
const expected = [
4850
'- `main` <!-- branch-stack -->',
49-
' - #1 :point_left:',
51+
' - **feat: implement feature 1** :point_left:',
5052
' - #2',
5153
].join('\n')
5254

src/renderer.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ export function renderVisualization(
4444
}
4545

4646
if (stackNode.type === 'pull-request') {
47-
line += `- #${stackNode.number}`
48-
}
49-
50-
if (stackNode.isCurrent) {
51-
line += ' :point_left:'
47+
if (stackNode.isCurrent) {
48+
line += `- **${stackNode.title}**`
49+
line += ' :point_left:'
50+
} else {
51+
line += `- #${stackNode.number}`
52+
}
5253
}
5354

55+
// Attach anchor tag to root of visualization to enable subsequent runs to locate
56+
// visualization directly
5457
if (depth === 0) {
5558
line += ` ${ANCHOR}`
5659
}

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const pullRequestSchema = object({
1515
}),
1616
state: string(),
1717
body: string().optional().nullable(),
18+
title: string(),
1819
})
1920
export type PullRequest = InferType<typeof pullRequestSchema>
2021

0 commit comments

Comments
 (0)