Merge pull request #4156 from github/mario-campos/fix-validate-cmd · github/codeql-action@a6ef2c9 · GitHub
Skip to content

Commit a6ef2c9

Browse files
authored
Merge pull request #4156 from github/mario-campos/fix-validate-cmd
Fix path-resolution bug in `changenotes.mts validate` by using `getChangenotes`
2 parents 1ef28a1 + 738bd62 commit a6ef2c9

3 files changed

Lines changed: 7 additions & 53 deletions

File tree

‎pr-checks/changelog/validate.mts‎

Lines changed: 0 additions & 11 deletions

‎pr-checks/changelog/validate.test.mts‎

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import assert from "node:assert/strict";
2-
import * as fs from "node:fs";
3-
import * as path from "node:path";
42
import { describe, it } from "node:test";
53

6-
import { withTmpDir, withTmpFile } from "../../src/util";
4+
import { withTmpFile } from "../../src/util";
75

86
import {
97
hasValidChangenoteCategory,
10-
isValidAllChangenoteFiles,
118
isValidChangenoteContent,
129
isValidChangenoteFile,
1310
isValidChangenoteFilename,
@@ -187,39 +184,3 @@ await describe("isValidChangenoteFile", async () => {
187184
);
188185
});
189186
});
190-
191-
await describe("isValidAllChangenoteFiles", async () => {
192-
await it("accepts list of file paths of valid change-notes", async () => {
193-
await withTmpDir(async (tmpDir) => {
194-
const fileName1 = path.join(tmpDir, "2026-01-01-fix-bug.md");
195-
const fileName2 = path.join(tmpDir, "2026-01-02-add-feature.md");
196-
fs.writeFileSync(fileName1, "---\ncategory: fix\n---\n- Fixed a bug\n");
197-
fs.writeFileSync(
198-
fileName2,
199-
"---\ncategory: feature\n---\n- Added a feature\n",
200-
);
201-
assert.equal(isValidAllChangenoteFiles([fileName1, fileName2]), true);
202-
});
203-
});
204-
205-
await it("accepts the empty list", async () => {
206-
assert.equal(isValidAllChangenoteFiles([]), true);
207-
});
208-
209-
await it("accepts list of .gitkeep", async () => {
210-
assert.equal(isValidAllChangenoteFiles([".gitkeep"]), true);
211-
});
212-
213-
await it("rejects list containing a file path to an invalid change-note", async () => {
214-
await withTmpDir(async (tmpDir) => {
215-
const fileName1 = path.join(tmpDir, "2026-01-01-fix-bug.md");
216-
const fileName2 = path.join(tmpDir, "2026-01-02-wrong-category.md");
217-
fs.writeFileSync(fileName1, "---\ncategory: fix\n---\n- Fixed a bug\n");
218-
fs.writeFileSync(
219-
fileName2,
220-
"---\ncategory: foobar\n---\n- Added a feature\n",
221-
);
222-
assert.equal(isValidAllChangenoteFiles([fileName1, fileName2]), false);
223-
});
224-
});
225-
});

‎pr-checks/changenotes.mts‎

Lines changed: 6 additions & 2 deletions

0 commit comments

Comments
 (0)