From dc2c619f16f1c5423b30eb8c6df4c397863838c3 Mon Sep 17 00:00:00 2001 From: Andrea Fassina Date: Sat, 27 May 2023 12:27:53 +0200 Subject: [PATCH 1/4] tools: deps update authenticate github api request --- tools/dep_updaters/update-ada.sh | 6 +++++- tools/dep_updaters/update-base64.sh | 6 +++++- tools/dep_updaters/update-brotli.sh | 6 +++++- tools/dep_updaters/update-c-ares.sh | 6 +++++- tools/dep_updaters/update-cjs-module-lexer.sh | 6 +++++- tools/dep_updaters/update-icu.sh | 6 +++++- tools/dep_updaters/update-libuv.sh | 6 +++++- tools/dep_updaters/update-llhttp.sh | 6 +++++- tools/dep_updaters/update-nghttp2.sh | 6 +++++- tools/dep_updaters/update-nghttp3.sh | 6 +++++- tools/dep_updaters/update-ngtcp2.sh | 6 +++++- tools/dep_updaters/update-simdutf.sh | 6 +++++- tools/dep_updaters/update-uvwasi.sh | 6 +++++- 13 files changed, 65 insertions(+), 13 deletions(-) diff --git a/tools/dep_updaters/update-ada.sh b/tools/dep_updaters/update-ada.sh index a26f854a1b2c52..d2a4d9f25862d8 100755 --- a/tools/dep_updaters/update-ada.sh +++ b/tools/dep_updaters/update-ada.sh @@ -11,7 +11,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest'); +const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-base64.sh b/tools/dep_updaters/update-base64.sh index ff39a5f6e82010..cd567d422fb631 100755 --- a/tools/dep_updaters/update-base64.sh +++ b/tools/dep_updaters/update-base64.sh @@ -12,7 +12,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/aklomp/base64/releases/latest'); +const res = await fetch('https://api.github.com/repos/aklomp/base64/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-brotli.sh b/tools/dep_updaters/update-brotli.sh index 3e9d6eddeaf665..442961d9fbd97c 100755 --- a/tools/dep_updaters/update-brotli.sh +++ b/tools/dep_updaters/update-brotli.sh @@ -12,7 +12,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/google/brotli/releases/latest'); +const res = await fetch('https://api.github.com/repos/google/brotli/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-c-ares.sh b/tools/dep_updaters/update-c-ares.sh index 4bef7d20abca19..8b0511369f5aa0 100755 --- a/tools/dep_updaters/update-c-ares.sh +++ b/tools/dep_updaters/update-c-ares.sh @@ -12,7 +12,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest'); +const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('cares-', '').replaceAll('_', '.')); diff --git a/tools/dep_updaters/update-cjs-module-lexer.sh b/tools/dep_updaters/update-cjs-module-lexer.sh index 151a57ebb07460..f48f623ab93c4a 100755 --- a/tools/dep_updaters/update-cjs-module-lexer.sh +++ b/tools/dep_updaters/update-cjs-module-lexer.sh @@ -11,7 +11,11 @@ DEPS_DIR="$BASE_DIR/deps" NPM="$DEPS_DIR/npm/bin/npm-cli.js" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags'); +const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const tags = await res.json(); const { name } = tags.at(0) diff --git a/tools/dep_updaters/update-icu.sh b/tools/dep_updaters/update-icu.sh index 1a5a57853f477c..0b411c98892eaa 100755 --- a/tools/dep_updaters/update-icu.sh +++ b/tools/dep_updaters/update-icu.sh @@ -10,7 +10,11 @@ TOOLS_DIR="$BASE_DIR/tools" [ -x "$NODE" ] || NODE=$(command -v node) NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest'); +const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('release-', '').replace('-','.')); diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index ed4d36170451b8..175005b92eb7bc 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -12,7 +12,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest'); +const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-llhttp.sh b/tools/dep_updaters/update-llhttp.sh index 30fb06667ece5b..e597e09609a294 100755 --- a/tools/dep_updaters/update-llhttp.sh +++ b/tools/dep_updaters/update-llhttp.sh @@ -13,7 +13,11 @@ DEPS_DIR="${BASE_DIR}/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest'); +const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('release/v', '')); diff --git a/tools/dep_updaters/update-nghttp2.sh b/tools/dep_updaters/update-nghttp2.sh index 5ee7f1f08da0a2..b8287fc0ee23e6 100755 --- a/tools/dep_updaters/update-nghttp2.sh +++ b/tools/dep_updaters/update-nghttp2.sh @@ -12,7 +12,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest'); +const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-nghttp3.sh b/tools/dep_updaters/update-nghttp3.sh index f10165960dabae..420b356b74bf72 100755 --- a/tools/dep_updaters/update-nghttp3.sh +++ b/tools/dep_updaters/update-nghttp3.sh @@ -11,7 +11,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ngtcp2/nghttp3/releases'); +const res = await fetch('https://api.github.com/repos/ngtcp2/nghttp3/releases', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const releases = await res.json() const { tag_name } = releases.at(0); diff --git a/tools/dep_updaters/update-ngtcp2.sh b/tools/dep_updaters/update-ngtcp2.sh index 9e9803ee6197e6..356e0a37825b1e 100755 --- a/tools/dep_updaters/update-ngtcp2.sh +++ b/tools/dep_updaters/update-ngtcp2.sh @@ -11,7 +11,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases'); +const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const releases = await res.json() const { tag_name } = releases.at(0); diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index 9eaa9f8149ef63..718dbedff51c0c 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -11,7 +11,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest'); +const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-uvwasi.sh b/tools/dep_updaters/update-uvwasi.sh index 8ba9dbd9e1d150..d9000468692aa2 100755 --- a/tools/dep_updaters/update-uvwasi.sh +++ b/tools/dep_updaters/update-uvwasi.sh @@ -12,7 +12,11 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest'); +const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest', { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, +}); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); From 9bfeedf3e9c2e843438b23321b5baf2c4881e879 Mon Sep 17 00:00:00 2001 From: Andrea Fassina Date: Mon, 29 May 2023 00:22:12 +0200 Subject: [PATCH 2/4] Update tools/dep_updaters/update-ada.sh Co-authored-by: Mestery --- tools/dep_updaters/update-ada.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dep_updaters/update-ada.sh b/tools/dep_updaters/update-ada.sh index d2a4d9f25862d8..6a2e1474d1c521 100755 --- a/tools/dep_updaters/update-ada.sh +++ b/tools/dep_updaters/update-ada.sh @@ -11,7 +11,7 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest', { +const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest', process.env.GITHUB_TOKEN && { headers: { "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` }, From 9d338f73123d27ebc0d140fa6da007ba11113a33 Mon Sep 17 00:00:00 2001 From: Andrea Fassina Date: Mon, 29 May 2023 00:24:57 +0200 Subject: [PATCH 3/4] tools: authenticated request if GITHUB_TOKEN exist --- tools/dep_updaters/update-base64.sh | 11 ++++++----- tools/dep_updaters/update-brotli.sh | 11 ++++++----- tools/dep_updaters/update-c-ares.sh | 11 ++++++----- tools/dep_updaters/update-cjs-module-lexer.sh | 11 ++++++----- tools/dep_updaters/update-icu.sh | 11 ++++++----- tools/dep_updaters/update-libuv.sh | 11 ++++++----- tools/dep_updaters/update-llhttp.sh | 11 ++++++----- tools/dep_updaters/update-nghttp2.sh | 11 ++++++----- tools/dep_updaters/update-nghttp3.sh | 11 ++++++----- tools/dep_updaters/update-ngtcp2.sh | 11 ++++++----- tools/dep_updaters/update-simdutf.sh | 11 ++++++----- tools/dep_updaters/update-uvwasi.sh | 11 ++++++----- 12 files changed, 72 insertions(+), 60 deletions(-) diff --git a/tools/dep_updaters/update-base64.sh b/tools/dep_updaters/update-base64.sh index cd567d422fb631..7bc8e274ecaf11 100755 --- a/tools/dep_updaters/update-base64.sh +++ b/tools/dep_updaters/update-base64.sh @@ -12,11 +12,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/aklomp/base64/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/aklomp/base64/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-brotli.sh b/tools/dep_updaters/update-brotli.sh index 442961d9fbd97c..c8daf695e14a08 100755 --- a/tools/dep_updaters/update-brotli.sh +++ b/tools/dep_updaters/update-brotli.sh @@ -12,11 +12,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/google/brotli/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/google/brotli/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-c-ares.sh b/tools/dep_updaters/update-c-ares.sh index 8b0511369f5aa0..fa7186328ba8e9 100755 --- a/tools/dep_updaters/update-c-ares.sh +++ b/tools/dep_updaters/update-c-ares.sh @@ -12,11 +12,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/c-ares/c-ares/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('cares-', '').replaceAll('_', '.')); diff --git a/tools/dep_updaters/update-cjs-module-lexer.sh b/tools/dep_updaters/update-cjs-module-lexer.sh index f48f623ab93c4a..94adeea05e1a16 100755 --- a/tools/dep_updaters/update-cjs-module-lexer.sh +++ b/tools/dep_updaters/update-cjs-module-lexer.sh @@ -11,11 +11,12 @@ DEPS_DIR="$BASE_DIR/deps" NPM="$DEPS_DIR/npm/bin/npm-cli.js" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/nodejs/cjs-module-lexer/tags', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const tags = await res.json(); const { name } = tags.at(0) diff --git a/tools/dep_updaters/update-icu.sh b/tools/dep_updaters/update-icu.sh index 0b411c98892eaa..22f7321c2c8f7a 100755 --- a/tools/dep_updaters/update-icu.sh +++ b/tools/dep_updaters/update-icu.sh @@ -10,11 +10,12 @@ TOOLS_DIR="$BASE_DIR/tools" [ -x "$NODE" ] || NODE=$(command -v node) NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('release-', '').replace('-','.')); diff --git a/tools/dep_updaters/update-libuv.sh b/tools/dep_updaters/update-libuv.sh index 175005b92eb7bc..8d45e770fb747b 100755 --- a/tools/dep_updaters/update-libuv.sh +++ b/tools/dep_updaters/update-libuv.sh @@ -12,11 +12,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/libuv/libuv/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-llhttp.sh b/tools/dep_updaters/update-llhttp.sh index e597e09609a294..dda203609a3a50 100755 --- a/tools/dep_updaters/update-llhttp.sh +++ b/tools/dep_updaters/update-llhttp.sh @@ -13,11 +13,12 @@ DEPS_DIR="${BASE_DIR}/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/nodejs/llhttp/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('release/v', '')); diff --git a/tools/dep_updaters/update-nghttp2.sh b/tools/dep_updaters/update-nghttp2.sh index b8287fc0ee23e6..d712221b680dcb 100755 --- a/tools/dep_updaters/update-nghttp2.sh +++ b/tools/dep_updaters/update-nghttp2.sh @@ -12,11 +12,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/nghttp2/nghttp2/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-nghttp3.sh b/tools/dep_updaters/update-nghttp3.sh index 420b356b74bf72..dd82aad195cc7e 100755 --- a/tools/dep_updaters/update-nghttp3.sh +++ b/tools/dep_updaters/update-nghttp3.sh @@ -11,11 +11,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ngtcp2/nghttp3/releases', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/ngtcp2/nghttp3/releases', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const releases = await res.json() const { tag_name } = releases.at(0); diff --git a/tools/dep_updaters/update-ngtcp2.sh b/tools/dep_updaters/update-ngtcp2.sh index 356e0a37825b1e..b8d8842b73f5be 100755 --- a/tools/dep_updaters/update-ngtcp2.sh +++ b/tools/dep_updaters/update-ngtcp2.sh @@ -11,11 +11,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/ngtcp2/ngtcp2/releases', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const releases = await res.json() const { tag_name } = releases.at(0); diff --git a/tools/dep_updaters/update-simdutf.sh b/tools/dep_updaters/update-simdutf.sh index 718dbedff51c0c..7076b6dd57cdd7 100755 --- a/tools/dep_updaters/update-simdutf.sh +++ b/tools/dep_updaters/update-simdutf.sh @@ -11,11 +11,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/simdutf/simdutf/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); diff --git a/tools/dep_updaters/update-uvwasi.sh b/tools/dep_updaters/update-uvwasi.sh index d9000468692aa2..5583f3ffad41ab 100755 --- a/tools/dep_updaters/update-uvwasi.sh +++ b/tools/dep_updaters/update-uvwasi.sh @@ -12,11 +12,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest', { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/nodejs/uvwasi/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', '')); From fde737df8e6b829c48c1f28b2d70af3e8e8523b9 Mon Sep 17 00:00:00 2001 From: Andrea Fassina Date: Mon, 29 May 2023 00:38:45 +0200 Subject: [PATCH 4/4] tools: format code --- tools/dep_updaters/update-ada.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/dep_updaters/update-ada.sh b/tools/dep_updaters/update-ada.sh index 6a2e1474d1c521..a714596a88f66f 100755 --- a/tools/dep_updaters/update-ada.sh +++ b/tools/dep_updaters/update-ada.sh @@ -11,11 +11,12 @@ DEPS_DIR="$BASE_DIR/deps" . "$BASE_DIR/tools/dep_updaters/utils.sh" NEW_VERSION="$("$NODE" --input-type=module <<'EOF' -const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest', process.env.GITHUB_TOKEN && { - headers: { - "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` - }, -}); +const res = await fetch('https://api.github.com/repos/ada-url/ada/releases/latest', + process.env.GITHUB_TOKEN && { + headers: { + "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` + }, + }); if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); const { tag_name } = await res.json(); console.log(tag_name.replace('v', ''));