Skip to content

Commit ec83290

Browse files
authored
Merge pull request #142 from beNative/codex/analyze-automatic-update-system-issues-930shb
Skip unpacked directories when validating release assets
2 parents d7b909a + 9ee124e commit ec83290

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

scripts/__tests__/release-workflow.test.mjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,46 @@ test('release tooling rewrites metadata and keeps latest.yml published', async (
230230
await runLocalVerification(releaseDir);
231231
});
232232

233+
test('release tooling ignores unpacked directories when enforcing metadata', async (t) => {
234+
const workspace = await createTemporaryWorkspace(t);
235+
await writeFixtureInstaller(workspace, '0.0.2', {
236+
artifactDir: 'docforge-windows-x64',
237+
});
238+
239+
const unpackedDir = path.join(
240+
workspace,
241+
'release-artifacts',
242+
'docforge-windows-x64',
243+
'win-unpacked',
244+
);
245+
await fs.mkdir(unpackedDir, { recursive: true });
246+
const unpackedExecutable = path.join(unpackedDir, 'DocForge.exe');
247+
await fs.writeFile(unpackedExecutable, crypto.randomBytes(2048));
248+
249+
const changelogPath = path.join(workspace, 'CHANGELOG.md');
250+
await fs.writeFile(
251+
changelogPath,
252+
['## v0.0.2', '', '- Ignore unpacked executable fixtures.'].join('\n'),
253+
'utf8',
254+
);
255+
256+
const notesPath = path.join(workspace, 'release-notes.md');
257+
const manifestPath = path.join(workspace, 'release-files.txt');
258+
259+
await runGenerateReleaseNotes({
260+
workspace,
261+
version: '0.0.2',
262+
tag: 'v0.0.2',
263+
changelogPath,
264+
outputPath: notesPath,
265+
filesOutputPath: manifestPath,
266+
});
267+
268+
const manifest = await fs.readFile(manifestPath, 'utf8');
269+
const entries = readManifestEntries(manifest);
270+
assert(entries.every((line) => !line.includes('DocForge.exe')));
271+
});
272+
233273
test('local verification can repair mismatched metadata when requested', async (t) => {
234274
const workspace = await createTemporaryWorkspace(t);
235275
const version = '0.0.2';

scripts/generate-release-notes.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ async function collectAssets(artifactRoot) {
261261
continue;
262262
}
263263

264+
const artifactSegments = artifactDir.split(path.sep).filter(Boolean);
265+
if (artifactSegments.some((segment) => segment.endsWith('-unpacked'))) {
266+
continue;
267+
}
268+
264269
if (!isReleaseAsset(fileName)) {
265270
continue;
266271
}

0 commit comments

Comments
 (0)