Skip to content

Commit a60bc41

Browse files
fasenderostargos
authored andcommitted
tools: deps update authenticate github api request
PR-URL: #48200 Fixes: #48119 Refs: nodejs/security-wg#973 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent 2b51ee5 commit a60bc41

13 files changed

+78
-13
lines changed

tools/dep_updaters/update-ada.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ DEPS_DIR="$BASE_DIR/deps"
1111
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1212

1313
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest');
14+
const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest',
15+
process.env.GITHUB_TOKEN && {
16+
headers: {
17+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
18+
},
19+
});
1520
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1621
const { tag_name } = await res.json();
1722
console.log(tag_name.replace('v', ''));

tools/dep_updaters/update-base64.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ DEPS_DIR="$BASE_DIR/deps"
1212
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1313

1414
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
15-
const res = await fetch('https://api.github.com/repos/aklomp/base64/releases/latest');
15+
const res = await fetch('https://api.github.com/repos/aklomp/base64/releases/latest',
16+
process.env.GITHUB_TOKEN && {
17+
headers: {
18+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
19+
},
20+
});
1621
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1722
const { tag_name } = await res.json();
1823
console.log(tag_name.replace('v', ''));

tools/dep_updaters/update-brotli.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ DEPS_DIR="$BASE_DIR/deps"
1212
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1313

1414
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
15-
const res = await fetch('https://api.github.com/repos/google/brotli/releases/latest');
15+
const res = await fetch('https://api.github.com/repos/google/brotli/releases/latest',
16+
process.env.GITHUB_TOKEN && {
17+
headers: {
18+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
19+
},
20+
});
1621
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1722
const { tag_name } = await res.json();
1823
console.log(tag_name.replace('v', ''));

tools/dep_updaters/update-c-ares.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ DEPS_DIR="$BASE_DIR/deps"
1212
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1313

1414
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
15-
const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest');
15+
const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest',
16+
process.env.GITHUB_TOKEN && {
17+
headers: {
18+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
19+
},
20+
});
1621
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1722
const { tag_name } = await res.json();
1823
console.log(tag_name.replace('cares-', '').replaceAll('_', '.'));

tools/dep_updaters/update-cjs-module-lexer.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ DEPS_DIR="$BASE_DIR/deps"
1111
NPM="$DEPS_DIR/npm/bin/npm-cli.js"
1212

1313
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags');
14+
const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags',
15+
process.env.GITHUB_TOKEN && {
16+
headers: {
17+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
18+
},
19+
});
1520
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1621
const tags = await res.json();
1722
const { name } = tags.at(0)

tools/dep_updaters/update-icu.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ TOOLS_DIR="$BASE_DIR/tools"
1010
[ -x "$NODE" ] || NODE=$(command -v node)
1111

1212
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
13-
const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest');
13+
const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest',
14+
process.env.GITHUB_TOKEN && {
15+
headers: {
16+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
17+
},
18+
});
1419
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1520
const { tag_name } = await res.json();
1621
console.log(tag_name.replace('release-', '').replace('-','.'));

tools/dep_updaters/update-libuv.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ DEPS_DIR="$BASE_DIR/deps"
1111
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1212

1313
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest');
14+
const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest',
15+
process.env.GITHUB_TOKEN && {
16+
headers: {
17+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
18+
},
19+
});
1520
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1621
const { tag_name } = await res.json();
1722
console.log(tag_name.replace('v', ''));

tools/dep_updaters/update-llhttp.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ DEPS_DIR="${BASE_DIR}/deps"
1313
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1414

1515
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
16-
const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest');
16+
const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest',
17+
process.env.GITHUB_TOKEN && {
18+
headers: {
19+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
20+
},
21+
});
1722
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1823
const { tag_name } = await res.json();
1924
console.log(tag_name.replace('release/v', ''));

tools/dep_updaters/update-nghttp2.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ DEPS_DIR="$BASE_DIR/deps"
1212
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1313

1414
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
15-
const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest');
15+
const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest',
16+
process.env.GITHUB_TOKEN && {
17+
headers: {
18+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
19+
},
20+
});
1621
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1722
const { tag_name } = await res.json();
1823
console.log(tag_name.replace('v', ''));

tools/dep_updaters/update-nghttp3.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ DEPS_DIR="$BASE_DIR/deps"
1111
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1212

1313
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/ngtcp2/nghttp3/releases');
14+
const res = await fetch('https://api.github.com/repos/ngtcp2/nghttp3/releases',
15+
process.env.GITHUB_TOKEN && {
16+
headers: {
17+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
18+
},
19+
});
1520
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1621
const releases = await res.json()
1722
const { tag_name } = releases.at(0);

tools/dep_updaters/update-ngtcp2.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ DEPS_DIR="$BASE_DIR/deps"
1111
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1212

1313
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases');
14+
const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases',
15+
process.env.GITHUB_TOKEN && {
16+
headers: {
17+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
18+
},
19+
});
1520
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1621
const releases = await res.json()
1722
const { tag_name } = releases.at(0);

tools/dep_updaters/update-simdutf.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ DEPS_DIR="$BASE_DIR/deps"
1111
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1212

1313
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest');
14+
const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest',
15+
process.env.GITHUB_TOKEN && {
16+
headers: {
17+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
18+
},
19+
});
1520
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1621
const { tag_name } = await res.json();
1722
console.log(tag_name.replace('v', ''));

tools/dep_updaters/update-uvwasi.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ DEPS_DIR="$BASE_DIR/deps"
1212
. "$BASE_DIR/tools/dep_updaters/utils.sh"
1313

1414
NEW_VERSION="$("$NODE" --input-type=module <<'EOF'
15-
const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest');
15+
const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest',
16+
process.env.GITHUB_TOKEN && {
17+
headers: {
18+
"Authorization": `Bearer ${process.env.GITHUB_TOKEN}`
19+
},
20+
});
1621
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
1722
const { tag_name } = await res.json();
1823
console.log(tag_name.replace('v', ''));

0 commit comments

Comments
 (0)