Skip to content

Commit

Permalink
feat: support https proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Mura-Mi committed Oct 5, 2024
1 parent 5e01c01 commit 2f61fad
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion src/version.mjs
Original file line number Diff line number Diff line change
@@ -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}$/;

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2f61fad

Please sign in to comment.