From 2f61fad2a8aad48a2ef6e6808f3866da623e0f4c Mon Sep 17 00:00:00 2001 From: "Takuya \"Mura-Mi\" Murakami" Date: Sat, 5 Oct 2024 21:20:16 +0900 Subject: [PATCH] feat: support https proxy --- node_modules/.package-lock.json | 2 +- package-lock.json | 5 +++-- package.json | 1 + src/version.mjs | 8 +++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 28ac834c..207767e8 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -1,6 +1,6 @@ { "name": "setup-deno", - "version": "1.5.0", + "version": "1.5.1", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package-lock.json b/package-lock.json index 4e49f9e7..fd0ff196 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "setup-deno", - "version": "1.5.0", + "version": "1.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "setup-deno", - "version": "1.5.0", + "version": "1.5.1", "license": "MIT", "dependencies": { "@actions/core": "^1.10.1", + "@actions/http-client": "^2.2.3", "@actions/tool-cache": "^2.0.1", "semver": "^7.6.3", "undici": "^6.19.8" diff --git a/package.json b/package.json index cdeb6982..c7194307 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "type": "module", "dependencies": { "@actions/core": "^1.10.1", + "@actions/http-client": "^2.2.3", "@actions/tool-cache": "^2.0.1", "semver": "^7.6.3", "undici": "^6.19.8" diff --git a/src/version.mjs b/src/version.mjs index 8f5f8f87..0aadd801 100644 --- a/src/version.mjs +++ b/src/version.mjs @@ -1,6 +1,7 @@ import semver from "semver"; import { fetch } from "undici"; import * as fs from "node:fs"; +import { HttpClient } from "@actions/http-client"; const GIT_HASH_RE = /^[0-9a-fA-F]{40}$/; @@ -188,12 +189,17 @@ async function resolveRelease(range) { /** @param {string} url */ async function fetchWithRetries(url, maxRetries = 5) { + const dispatcher = new HttpClient().getAgentDispatcher(url); + let sleepMs = 250; let iterationCount = 0; while (true) { iterationCount++; try { - const res = await fetch(url); + const res = await fetch( + url, + { dispatcher: dispatcher }, + ); if (res.status === 200 || iterationCount > maxRetries) { return res; }