Skip to content

Commit 208bfac

Browse files
committed
fix: align no-tag version baselines
1 parent 6bd5dcc commit 208bfac

2 files changed

Lines changed: 38 additions & 5 deletions

File tree

.github/scripts/version.test.ts

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ describe("run", () => {
812812
"npm view fallback-package version": "0.1.0",
813813
"git log --format=%s": "docs: note fallback behavior",
814814
"git log --format=%b": "",
815-
"git show --format= --name-only HEAD": "src/mod.ts\n",
815+
"git log --format= --name-only": "src/mod.ts\n",
816816
},
817817
now: new Date("2026-02-12T09:14:29Z"),
818818
});
@@ -848,7 +848,7 @@ describe("run", () => {
848848
"npm view commented-package version": "0.2.0",
849849
"git log --format=%s": "docs: note jsonc support",
850850
"git log --format=%b": "",
851-
"git show --format= --name-only HEAD": ".github/scripts/version.ts\n",
851+
"git log --format= --name-only": ".github/scripts/version.ts\n",
852852
},
853853
now: new Date("2026-02-12T09:14:29Z"),
854854
});
@@ -908,8 +908,7 @@ describe("run", () => {
908908
"npm view fallback-package version": "0.1.0",
909909
"git log --format=%s": "docs: note fallback behavior",
910910
"git log --format=%b": "",
911-
"git show --format= --name-only HEAD":
912-
".github/scripts/version.test.ts\n",
911+
"git log --format= --name-only": ".github/scripts/version.test.ts\n",
913912
},
914913
now: new Date("2026-02-12T09:14:29Z"),
915914
});
@@ -922,6 +921,40 @@ describe("run", () => {
922921
"No release-triggering commits since initial, skipping",
923922
]);
924923
});
924+
925+
it("does not skip in the no-tag fallback when earlier unreleased commits changed non-test files", async () => {
926+
const cli = makeCliDeps({
927+
env: {
928+
GITHUB_EVENT_NAME: "pull_request",
929+
GITHUB_OUTPUT: "/tmp/github-output",
930+
},
931+
files: {
932+
"package.json": JSON.stringify({ name: "fallback-package" }),
933+
},
934+
commands: {
935+
"git rev-parse HEAD": "abcdef1234567890",
936+
"git describe --tags --abbrev=0 --match v*": new Error("no tags"),
937+
"npm view fallback-package version": "0.1.0",
938+
"git log --format=%s":
939+
"docs: follow-up test coverage\nfeat: ship fallback alignment",
940+
"git log --format=%b": "\n",
941+
"git log --format= --name-only":
942+
".github/scripts/version.test.ts\nsrc/mod.ts\n.github/scripts/version.test.ts\n",
943+
},
944+
now: new Date("2026-02-12T09:14:29Z"),
945+
});
946+
947+
await run([], cli.deps);
948+
949+
assertEquals(cli.outputs, [
950+
"version=0.1.1-canary.abcdef1.20260212091429\n",
951+
"tag=canary\n",
952+
]);
953+
assertEquals(
954+
cli.logs.at(-1),
955+
"Canary version: 0.1.1-canary.abcdef1.20260212091429",
956+
);
957+
});
925958
});
926959

927960
describe("parseCommandOutput", () => {

.github/scripts/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ export async function run(
408408
subjects = (await cmd("git", "log", "--format=%s")).split("\n");
409409
bodies = (await cmd("git", "log", "--format=%b")).split("\n");
410410
changedFiles = parseChangedFiles(
411-
await cmd("git", "show", "--format=", "--name-only", "HEAD"),
411+
await cmd("git", "log", "--format=", "--name-only"),
412412
);
413413
noGitTags = true;
414414
} else {

0 commit comments

Comments
 (0)