Skip to content

Commit fa38d49

Browse files
committed
deps: update undici to latest v7.x release only
Modify update-undici.sh to fetch all releases and filter to only v7.x releases, then select the latest one. This ensures we stay on the v7.x line and don't accidentally upgrade to v8 or later.
1 parent a072411 commit fa38d49

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tools/dep_updaters/update-undici.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@ NPM="$ROOT/deps/npm/bin/npm-cli.js"
1717
. "$ROOT/tools/dep_updaters/utils.sh"
1818

1919
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
20-
const res = await fetch('https://api.github.com/repos/nodejs/undici/releases/latest',
20+
const res = await fetch('https://api.github.com/repos/nodejs/undici/releases',
2121
process.env.GITHUB_TOKEN && {
2222
headers: {
2323
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
2424
},
2525
});
2626
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
27-
const { tag_name } = await res.json();
27+
const releases = await res.json();
28+
const v7Releases = releases.filter(r => {
29+
const tag = r.tag_name.replace(/^v/, '');
30+
return tag.startsWith('7.');
31+
});
32+
if (v7Releases.length === 0) throw new Error('No v7.x releases found');
33+
// Sort by tag_name (prefixed with 'v') in descending order to get the latest first
34+
v7Releases.sort((a, b) => b.tag_name.localeCompare(a.tag_name));
35+
const { tag_name } = v7Releases[0];
2836
console.log(tag_name.replace('v', ''));
2937
EOF
3038
)"

0 commit comments

Comments
 (0)