Skip to content

Commit 6259a4c

Browse files
authored
Sort "preview" versions last, always (never 'latest')
1 parent 36fbdf2 commit 6259a4c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/automation/actions/link-check/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,13 @@ async function main() {
234234
}
235235

236236
for (const product in productVersions) {
237-
productVersions[product] = productVersions[product].sort((a, b) =>
238-
b.localeCompare(a, undefined, { numeric: true }),
239-
);
237+
// sort "preview" last, always
238+
productVersions[product] = productVersions[product].sort((a, b) => {
239+
if (a === "preview" && b === "preview") return 0;
240+
if (a === "preview") return 1;
241+
if (b === "preview") return -1;
242+
return b.localeCompare(a, undefined, { numeric: true });
243+
});
240244
}
241245

242246
// post-process redirects

0 commit comments

Comments
 (0)