Skip to content

Commit fe99f97

Browse files
ci(release): auto-patch-release only the 2 newest release lines
The Auto Patch Release cron walked every release-X.Y branch (21 of them, back to release-0.9) and cut a vX.Y.(Z+1) tag whenever a branch had commits after its latest published release. That fired patch releases on long-EOL lines (e.g. v1.3.6), whose release PRs then sit blocked on unrelated CI failures and accumulate stray draft releases, tags and changelog PRs. Restrict the cron to the SUPPORTED_LINE_COUNT (=2) newest minor lines. The window is derived from the branch list, so it slides automatically as new release-X.Y branches are cut — once release-1.5 exists the window becomes {1.5, 1.4} and the trailing line retires with no further edits. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 479929e commit fe99f97

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

‎.github/workflows/auto-release.yaml‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,30 @@ jobs:
6060
execSync('git config --unset-all http.https://github.com/.extraheader || true', { encoding: 'utf8' });
6161
6262
// Get all release-X.Y branches
63-
const branches = execSync('git branch -r | grep -E "origin/release-[0-9]+\\.[0-9]+$" | sed "s|origin/||" | tr -d " "', { encoding: 'utf8' })
63+
const allBranches = execSync('git branch -r | grep -E "origin/release-[0-9]+\\.[0-9]+$" | sed "s|origin/||" | tr -d " "', { encoding: 'utf8' })
6464
.split('\n')
6565
.filter(b => b.trim())
6666
.filter(b => /^release-\d+\.\d+$/.test(b));
67-
68-
console.log(`Found ${branches.length} release branches: ${branches.join(', ')}`);
67+
68+
// Only auto-patch-release the N newest minor lines. Older lines are
69+
// EOL: we don't want stray patch tags (and broken release PRs) cut
70+
// on them. The window slides automatically as new release-X.Y
71+
// branches are created — once release-1.5 exists the window becomes
72+
// {1.5, 1.4} and the trailing line retires on its own.
73+
const SUPPORTED_LINE_COUNT = 2;
74+
const lineNum = b => {
75+
const [maj, min] = b.replace('release-', '').split('.').map(Number);
76+
return maj * 1000 + min;
77+
};
78+
const branches = [...allBranches]
79+
.sort((a, b) => lineNum(b) - lineNum(a))
80+
.slice(0, SUPPORTED_LINE_COUNT);
81+
82+
const skipped = allBranches.filter(b => !branches.includes(b)).sort();
83+
console.log(`Found ${allBranches.length} release branches; auto-releasing the ${SUPPORTED_LINE_COUNT} newest: ${branches.join(', ')}`);
84+
if (skipped.length) {
85+
console.log(`Skipping ${skipped.length} EOL release branches: ${skipped.join(', ')}`);
86+
}
6987
7088
// Get all published releases (not draft)
7189
const allReleases = await github.rest.repos.listReleases({

0 commit comments

Comments
 (0)