Skip to content

Commit 7bd0371

Browse files
build(release): 3.1.0 [skip ci]
# [3.1.0](v3.0.0...v3.1.0) (2026-04-11) ### Bug Fixes * **deps:** bump p-retry from 7.1.1 to 8.0.0 ([#357](#357)) ([3bbe07d](3bbe07d)) ### Features * add `client-id` input and deprecate `app-id` ([#353](#353)) ([e6bd4e6](e6bd4e6)) * update permission inputs ([#358](#358)) ([076e948](076e948))
1 parent e6bd4e6 commit 7bd0371

File tree

3 files changed

+80
-37
lines changed

3 files changed

+80
-37
lines changed

dist/main.cjs

Lines changed: 77 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22964,30 +22964,37 @@ var isError = (value) => objectToString.call(value) === "[object Error]";
2296422964
var errorMessages = /* @__PURE__ */ new Set([
2296522965
"network error",
2296622966
// Chrome
22967-
"Failed to fetch",
22968-
// Chrome
2296922967
"NetworkError when attempting to fetch resource.",
2297022968
// Firefox
2297122969
"The Internet connection appears to be offline.",
2297222970
// Safari 16
22973-
"Load failed",
22974-
// Safari 17+
2297522971
"Network request failed",
2297622972
// `cross-fetch`
2297722973
"fetch failed",
2297822974
// Undici (Node.js)
22979-
"terminated"
22975+
"terminated",
2298022976
// Undici (Node.js)
22977+
" A network error occurred.",
22978+
// Bun (WebKit)
22979+
"Network connection lost"
22980+
// Cloudflare Workers (fetch)
2298122981
]);
2298222982
function isNetworkError(error2) {
2298322983
const isValid = error2 && isError(error2) && error2.name === "TypeError" && typeof error2.message === "string";
2298422984
if (!isValid) {
2298522985
return false;
2298622986
}
22987-
if (error2.message === "Load failed") {
22988-
return error2.stack === void 0;
22987+
const { message, stack } = error2;
22988+
if (message === "Load failed") {
22989+
return stack === void 0 || "__sentry_captured__" in error2;
22990+
}
22991+
if (message.startsWith("error sending request for url")) {
22992+
return true;
22993+
}
22994+
if (message === "Failed to fetch" || message.startsWith("Failed to fetch (") && message.endsWith(")")) {
22995+
return true;
2298922996
}
22990-
return errorMessages.has(error2.message);
22997+
return errorMessages.has(message);
2299122998
}
2299222999

2299323000
// node_modules/p-retry/index.js
@@ -23017,6 +23024,14 @@ function validateNumberOption(name, value, { min = 0, allowInfinity = false } =
2301723024
throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
2301823025
}
2301923026
}
23027+
function validateFunctionOption(name, value) {
23028+
if (value === void 0) {
23029+
return;
23030+
}
23031+
if (typeof value !== "function") {
23032+
throw new TypeError(`Expected \`${name}\` to be a function.`);
23033+
}
23034+
}
2302023035
var AbortError = class extends Error {
2302123036
constructor(message) {
2302223037
super();
@@ -23044,62 +23059,87 @@ function calculateRemainingTime(start, max) {
2304423059
}
2304523060
return max - (performance.now() - start);
2304623061
}
23062+
async function delayForRetry(delay, options) {
23063+
if (delay <= 0) {
23064+
return;
23065+
}
23066+
await new Promise((resolve2, reject) => {
23067+
const onAbort = () => {
23068+
clearTimeout(timeoutToken);
23069+
options.signal?.removeEventListener("abort", onAbort);
23070+
reject(options.signal.reason);
23071+
};
23072+
const timeoutToken = setTimeout(() => {
23073+
options.signal?.removeEventListener("abort", onAbort);
23074+
resolve2();
23075+
}, delay);
23076+
if (options.unref) {
23077+
timeoutToken.unref?.();
23078+
}
23079+
options.signal?.addEventListener("abort", onAbort, { once: true });
23080+
});
23081+
}
2304723082
async function onAttemptFailure({ error: error2, attemptNumber, retriesConsumed, startTime, options }) {
2304823083
const normalizedError = error2 instanceof Error ? error2 : new TypeError(`Non-error was thrown: "${error2}". You should only throw errors.`);
2304923084
if (normalizedError instanceof AbortError) {
2305023085
throw normalizedError.originalError;
2305123086
}
2305223087
const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
2305323088
const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
23089+
const delayTime = calculateDelay(retriesConsumed, options);
23090+
const remainingTimeBeforeCallbacks = calculateRemainingTime(startTime, maxRetryTime);
23091+
if (remainingTimeBeforeCallbacks <= 0) {
23092+
const context2 = Object.freeze({
23093+
error: normalizedError,
23094+
attemptNumber,
23095+
retriesLeft,
23096+
retriesConsumed,
23097+
retryDelay: 0
23098+
});
23099+
await options.onFailedAttempt(context2);
23100+
throw normalizedError;
23101+
}
23102+
const consumeRetryContext = Object.freeze({
23103+
error: normalizedError,
23104+
attemptNumber,
23105+
retriesLeft,
23106+
retriesConsumed,
23107+
retryDelay: retriesLeft > 0 ? delayTime : 0
23108+
});
23109+
const consumeRetry = await options.shouldConsumeRetry(consumeRetryContext);
23110+
const effectiveDelay = consumeRetry && retriesLeft > 0 ? delayTime : 0;
2305423111
const context = Object.freeze({
2305523112
error: normalizedError,
2305623113
attemptNumber,
2305723114
retriesLeft,
23058-
retriesConsumed
23115+
retriesConsumed,
23116+
retryDelay: effectiveDelay
2305923117
});
2306023118
await options.onFailedAttempt(context);
2306123119
if (calculateRemainingTime(startTime, maxRetryTime) <= 0) {
2306223120
throw normalizedError;
2306323121
}
23064-
const consumeRetry = await options.shouldConsumeRetry(context);
2306523122
const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
2306623123
if (remainingTime <= 0 || retriesLeft <= 0) {
2306723124
throw normalizedError;
2306823125
}
2306923126
if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
23070-
if (consumeRetry) {
23071-
throw normalizedError;
23072-
}
23073-
options.signal?.throwIfAborted();
23074-
return false;
23127+
throw normalizedError;
2307523128
}
2307623129
if (!await options.shouldRetry(context)) {
2307723130
throw normalizedError;
2307823131
}
23132+
const remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, maxRetryTime);
23133+
if (remainingTimeAfterShouldRetry <= 0) {
23134+
throw normalizedError;
23135+
}
2307923136
if (!consumeRetry) {
2308023137
options.signal?.throwIfAborted();
2308123138
return false;
2308223139
}
23083-
const delayTime = calculateDelay(retriesConsumed, options);
23084-
const finalDelay = Math.min(delayTime, remainingTime);
23140+
const finalDelay = Math.min(effectiveDelay, remainingTimeAfterShouldRetry);
2308523141
options.signal?.throwIfAborted();
23086-
if (finalDelay > 0) {
23087-
await new Promise((resolve2, reject) => {
23088-
const onAbort = () => {
23089-
clearTimeout(timeoutToken);
23090-
options.signal?.removeEventListener("abort", onAbort);
23091-
reject(options.signal.reason);
23092-
};
23093-
const timeoutToken = setTimeout(() => {
23094-
options.signal?.removeEventListener("abort", onAbort);
23095-
resolve2();
23096-
}, finalDelay);
23097-
if (options.unref) {
23098-
timeoutToken.unref?.();
23099-
}
23100-
options.signal?.addEventListener("abort", onAbort, { once: true });
23101-
});
23102-
}
23142+
await delayForRetry(finalDelay, options);
2310323143
options.signal?.throwIfAborted();
2310423144
return true;
2310523145
}
@@ -23119,6 +23159,9 @@ async function pRetry(input, options = {}) {
2311923159
};
2312023160
options.shouldRetry ??= () => true;
2312123161
options.shouldConsumeRetry ??= () => true;
23162+
validateFunctionOption("onFailedAttempt", options.onFailedAttempt);
23163+
validateFunctionOption("shouldRetry", options.shouldRetry);
23164+
validateFunctionOption("shouldConsumeRetry", options.shouldConsumeRetry);
2312223165
validateNumberOption("factor", options.factor, { min: 0, allowInfinity: false });
2312323166
validateNumberOption("minTimeout", options.minTimeout, { min: 0, allowInfinity: false });
2312423167
validateNumberOption("maxTimeout", options.maxTimeout, { min: 0, allowInfinity: true });

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "create-github-app-token",
33
"private": true,
44
"type": "module",
5-
"version": "3.0.0",
5+
"version": "3.1.0",
66
"description": "GitHub Action for creating a GitHub App Installation Access Token",
77
"engines": {
88
"node": ">=24.4.0"

0 commit comments

Comments
 (0)