Skip to content

Commit 1a6ea74

Browse files
Fix CI back-merge guard handling
1 parent 426e994 commit 1a6ea74

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ jobs:
213213
guard-suite:
214214
runs-on: ubuntu-latest
215215
needs: detect-changes
216+
env:
217+
FVPLUS_ALLOW_PACKAGED_SOURCE_DRIFT: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'backmerge/') && github.base_ref == 'dev' && '1' || '0' }}
216218
outputs:
217219
duration_seconds: ${{ steps.elapsed.outputs.seconds }}
218220

scripts/build_release_notes.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ if [[ -f "${OVERRIDE_FILE}" ]]; then
5656
5757
Install URL: \`https://raw.githubusercontent.com/alexphillips-dev/FolderView-Plus/${INSTALL_BRANCH}/folderview.plus.plg\`
5858
59+
### Changes
60+
5961
$(cat "${OVERRIDE_FILE}")
6062
EOF
6163
exit 0

scripts/release_notes_consistency_guard.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const plg = fs.readFileSync(path.join(root, 'folderview.plus.plg'), 'utf8');
2828
const releaseOnMain = fs.readFileSync(path.join(root, '.github/workflows/release-on-main.yml'), 'utf8');
2929
const releaseMain = fs.readFileSync(path.join(root, '.github/workflows/release-main.yml'), 'utf8');
3030
const rendered = fs.readFileSync(outputFile, 'utf8');
31+
const overridePath = path.join(root, 'docs', 'releases', `${version}.md`);
32+
const hasOverride = fs.existsSync(overridePath);
33+
const overrideBody = hasOverride ? fs.readFileSync(overridePath, 'utf8').trim() : '';
3134
3235
const fail = (message) => {
3336
console.error(`ERROR: ${message}`);
@@ -48,9 +51,18 @@ if (!rendered.includes(`## FolderView Plus ${version}`)) {
4851
if (!rendered.includes('### Changes')) {
4952
fail('Generated release notes are missing the changes heading.');
5053
}
51-
for (const line of notesBlock.split(/\r?\n/).filter(Boolean)) {
52-
if (!rendered.includes(line)) {
53-
fail(`Generated release notes are missing CHANGES line: ${line}`);
54+
if (hasOverride) {
55+
if (!overrideBody) {
56+
fail(`Curated release override ${path.relative(root, overridePath)} is empty.`);
57+
}
58+
if (!rendered.includes(overrideBody)) {
59+
fail(`Generated release notes are missing the curated override body from ${path.relative(root, overridePath)}.`);
60+
}
61+
} else {
62+
for (const line of notesBlock.split(/\r?\n/).filter(Boolean)) {
63+
if (!rendered.includes(line)) {
64+
fail(`Generated release notes are missing CHANGES line: ${line}`);
65+
}
5466
}
5567
}
5668
if (!/bash scripts\/build_release_notes\.sh/.test(releaseOnMain)) {

tests/versioning-guard.test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ test('release-on-main validates remote raw publish artifacts before publishing r
455455
test('release notes builder supports curated per-version override files', () => {
456456
assert.match(buildReleaseNotes, /OVERRIDE_FILE="docs\/releases\/\$\{VERSION\}\.md"/);
457457
assert.match(buildReleaseNotes, /\[\[ -f "\$\{OVERRIDE_FILE\}" \]\]/);
458+
assert.match(buildReleaseNotes, /Install URL:[\s\S]*### Changes[\s\S]*cat "\$\{OVERRIDE_FILE\}"/);
458459
assert.match(buildReleaseNotes, /cat "\$\{OVERRIDE_FILE\}"/);
459460
});
460461

@@ -594,6 +595,8 @@ test('docs metadata guard keeps readme and packaged descriptions aligned', () =>
594595
assert.match(buildReleaseNotes, /Install URL: \\`https:\/\/raw\.githubusercontent\.com\/alexphillips-dev\/FolderView-Plus\/\$\{INSTALL_BRANCH\}\/folderview\.plus\.plg\\`/);
595596
assert.match(buildReleaseNotes, /### Changes/);
596597
assert.match(releaseNotesConsistencyGuard, /Release notes consistency guard passed/);
598+
assert.match(releaseNotesConsistencyGuard, /docs', 'releases', `\$\{version\}\.md`/);
599+
assert.match(releaseNotesConsistencyGuard, /Generated release notes are missing the curated override body/);
597600
assert.match(releaseNotesConsistencyGuard, /mkdir -p "\$\{ROOT_DIR\}\/tmp"/);
598601
assert.match(releaseNotesConsistencyGuard, /TMP_DIR="\$\(mktemp -d "\$\{ROOT_DIR\}\/tmp\/release-notes-guard\.XXXXXX"\)"/);
599602
assert.match(releaseNotesConsistencyGuard, /build_release_notes\.sh --version/);

0 commit comments

Comments
 (0)