Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig-checker
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"Version": "v3.4.1",
"Verbose": false,
"Debug": false,
"IgnoreDefaults": false,
Expand Down
10 changes: 9 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/git-town.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Git Town
on:
pull_request:
branches:
- '**'
- "**"

concurrency:
group: git-town-${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.5.1
24.1.0
14 changes: 9 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/inputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe('getCurrentPullRequest', () => {
number: 100,
base: { ref: 'main' },
head: { ref: 'feat/git-town-action' },
title: 'feat: git town action',
state: 'open',
},
},
Expand All @@ -147,6 +148,7 @@ describe('getCurrentPullRequest', () => {
number: 100,
base: { ref: 'main' },
head: { ref: 'feat/git-town-action' },
title: 'feat: git town action',
state: 'open',
})
})
Expand Down
1 change: 1 addition & 0 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/renderer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('getOutput', () => {
},
state: 'TODO',
body: 'pr 1 body',
title: 'feat: implement feature 1',
}
const pullRequest2: PullRequest = {
number: 2,
Expand All @@ -27,6 +28,7 @@ describe('getOutput', () => {
},
state: 'TODO',
body: 'pr 2 body',
title: 'feat: implement feature 2',
}
const repoGraph = new DirectedGraph<StackNodeAttributes>()
repoGraph.mergeNode('main', { type: 'perennial', ref: 'main' })
Expand All @@ -46,7 +48,7 @@ describe('getOutput', () => {
const visualization = renderVisualization(stackGraph, ['main'])
const expected = [
'- `main` <!-- branch-stack -->',
' - #1 :point_left:',
' - **feat: implement feature 1** :point_left:',
' - #2',
].join('\n')

Expand Down
13 changes: 8 additions & 5 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const pullRequestSchema = object({
}),
state: string(),
body: string().optional().nullable(),
title: string(),
})
export type PullRequest = InferType<typeof pullRequestSchema>

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"rootDir": "src",
"rootDir": ".",
"outDir": "dist",
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
Expand All @@ -21,6 +21,6 @@
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["."],
"include": ["src", "vitest.config.ts", "vitest.setup.ts"],
"exclude": ["node_modules", "dist"]
}
7 changes: 7 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
setupFiles: ['vitest.setup.ts'],
},
})
17 changes: 17 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -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
})
})
Loading