mirror of
https://github.com/actions/create-github-app-token.git
synced 2026-12-05 15:22:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62c293567b | ||
|
|
7fa28c5965 |
No files matched your search
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "3.4.0"
|
||||
".": "3.4.1"
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## [3.4.1](https://github.com/actions/create-github-app-token/compare/v3.4.0...v3.4.1) (2026-12-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** bump p-retry from 8.0.1 to 9.0.0 ([#418](https://github.com/actions/create-github-app-token/issues/418)) ([dfd707c](https://github.com/actions/create-github-app-token/commit/dfd707cab9acab8d10acd802f1cde7a30f17d644))
|
||||
|
||||
## [3.4.0](https://github.com/actions/create-github-app-token/compare/v3.3.0...v3.4.0) (2026-11-18)
|
||||
|
||||
|
||||
|
||||
Vendored
+79
-70
@@ -23891,54 +23891,60 @@ function validateRetries(retries) {
|
||||
throw new TypeError("Expected `retries` to be a number or Infinity.");
|
||||
}
|
||||
}
|
||||
function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
|
||||
if (value === void 0) {
|
||||
return;
|
||||
}
|
||||
function validateNumberOption(name, value, { allowInfinity = false } = {}) {
|
||||
if (typeof value !== "number" || Number.isNaN(value)) {
|
||||
throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
|
||||
}
|
||||
if (!allowInfinity && !Number.isFinite(value)) {
|
||||
throw new TypeError(`Expected \`${name}\` to be a finite number.`);
|
||||
}
|
||||
if (value < min) {
|
||||
throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
|
||||
if (value < 0) {
|
||||
throw new TypeError(`Expected \`${name}\` to be \u2265 0.`);
|
||||
}
|
||||
}
|
||||
function validateFunctionOption(name, value) {
|
||||
if (value === void 0) {
|
||||
function validateOption(name, value, type) {
|
||||
if (value === void 0 || value === null) {
|
||||
return;
|
||||
}
|
||||
if (typeof value !== "function") {
|
||||
throw new TypeError(`Expected \`${name}\` to be a function.`);
|
||||
if (typeof value !== type) {
|
||||
throw new TypeError(`Expected \`${name}\` to be a ${type}.`);
|
||||
}
|
||||
}
|
||||
var AbortError = class extends Error {
|
||||
function validateSignal(value) {
|
||||
if (value === void 0 || value === null) {
|
||||
return;
|
||||
}
|
||||
if (typeof value.throwIfAborted !== "function" || typeof value.addEventListener !== "function" || typeof value.removeEventListener !== "function") {
|
||||
throw new TypeError("Expected `signal` to be an AbortSignal.");
|
||||
}
|
||||
}
|
||||
var AbortError = class _AbortError extends Error {
|
||||
constructor(message) {
|
||||
super();
|
||||
super(typeof message === "string" ? message : void 0);
|
||||
this.name = "AbortError";
|
||||
if (message instanceof Error) {
|
||||
this.originalError = message;
|
||||
({ message } = message);
|
||||
} else {
|
||||
this.originalError = new Error(message);
|
||||
this.originalError.stack = this.stack;
|
||||
({ message } = this.originalError);
|
||||
Error.captureStackTrace?.(this.originalError, _AbortError);
|
||||
}
|
||||
this.name = "AbortError";
|
||||
this.message = message;
|
||||
}
|
||||
};
|
||||
var maximumDelay = 2 ** 31 - 1;
|
||||
function calculateDelay(retriesConsumed, options) {
|
||||
const attempt = Math.max(1, retriesConsumed + 1);
|
||||
if (options.minTimeout === 0) {
|
||||
return 0;
|
||||
}
|
||||
const attempt = retriesConsumed + 1;
|
||||
const random = options.randomize ? Math.random() + 1 : 1;
|
||||
let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
|
||||
timeout = Math.min(timeout, options.maxTimeout);
|
||||
return timeout;
|
||||
const timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
|
||||
return Math.min(timeout, Math.ceil(options.maxTimeout), maximumDelay);
|
||||
}
|
||||
function calculateRemainingTime(start, max) {
|
||||
if (!Number.isFinite(max)) {
|
||||
return max;
|
||||
}
|
||||
return max - (performance.now() - start);
|
||||
return Number.isFinite(max) ? max - (performance.now() - start) : max;
|
||||
}
|
||||
async function delayForRetry(delay, options) {
|
||||
if (delay <= 0) {
|
||||
@@ -23947,7 +23953,6 @@ async function delayForRetry(delay, options) {
|
||||
await new Promise((resolve2, reject) => {
|
||||
const onAbort = () => {
|
||||
clearTimeout(timeoutToken);
|
||||
options.signal?.removeEventListener("abort", onAbort);
|
||||
reject(options.signal.reason);
|
||||
};
|
||||
const timeoutToken = setTimeout(() => {
|
||||
@@ -23960,35 +23965,43 @@ async function delayForRetry(delay, options) {
|
||||
options.signal?.addEventListener("abort", onAbort, { once: true });
|
||||
});
|
||||
}
|
||||
function stringifyThrownValue(value) {
|
||||
try {
|
||||
return String(value);
|
||||
} catch {
|
||||
return Object.prototype.toString.call(value);
|
||||
}
|
||||
}
|
||||
function unwrapAbortError(error2) {
|
||||
let cause = error2;
|
||||
while (cause instanceof AbortError && cause.originalError instanceof Error) {
|
||||
cause = cause.originalError;
|
||||
}
|
||||
return cause;
|
||||
}
|
||||
async function onAttemptFailure({ error: error2, attemptNumber, retriesConsumed, startTime, options }) {
|
||||
const normalizedError = error2 instanceof Error ? error2 : new TypeError(`Non-error was thrown: "${error2}". You should only throw errors.`);
|
||||
const abortIfNeeded = () => {
|
||||
options.signal?.throwIfAborted();
|
||||
};
|
||||
const normalizedError = error2 instanceof Error ? error2 : new TypeError(`Non-error was thrown: "${stringifyThrownValue(error2)}". You should only throw errors.`);
|
||||
abortIfNeeded();
|
||||
if (normalizedError instanceof AbortError) {
|
||||
throw normalizedError.originalError;
|
||||
}
|
||||
const retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;
|
||||
const maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;
|
||||
const delayTime = calculateDelay(retriesConsumed, options);
|
||||
const remainingTimeBeforeCallbacks = calculateRemainingTime(startTime, maxRetryTime);
|
||||
if (remainingTimeBeforeCallbacks <= 0) {
|
||||
const context2 = Object.freeze({
|
||||
error: normalizedError,
|
||||
attemptNumber,
|
||||
retriesLeft,
|
||||
retriesConsumed,
|
||||
retryDelay: 0
|
||||
});
|
||||
await options.onFailedAttempt(context2);
|
||||
throw normalizedError;
|
||||
throw unwrapAbortError(normalizedError);
|
||||
}
|
||||
const retriesLeft = options.retries - retriesConsumed;
|
||||
const isRetriableError = !(normalizedError instanceof TypeError) || isNetworkError(normalizedError);
|
||||
const timeLeft = calculateRemainingTime(startTime, options.maxRetryTime);
|
||||
const delayTime = isRetriableError && timeLeft > 0 && retriesLeft > 0 ? calculateDelay(retriesConsumed, options) : 0;
|
||||
const consumeRetryContext = Object.freeze({
|
||||
error: normalizedError,
|
||||
attemptNumber,
|
||||
retriesLeft,
|
||||
retriesConsumed,
|
||||
retryDelay: retriesLeft > 0 ? delayTime : 0
|
||||
retryDelay: delayTime
|
||||
});
|
||||
const consumeRetry = await options.shouldConsumeRetry(consumeRetryContext);
|
||||
const effectiveDelay = consumeRetry && retriesLeft > 0 ? delayTime : 0;
|
||||
const consumeRetry = await options.shouldConsumeRetry(consumeRetryContext) ?? true;
|
||||
abortIfNeeded();
|
||||
const effectiveDelay = consumeRetry ? delayTime : 0;
|
||||
const context = Object.freeze({
|
||||
error: normalizedError,
|
||||
attemptNumber,
|
||||
@@ -23997,64 +24010,60 @@ async function onAttemptFailure({ error: error2, attemptNumber, retriesConsumed,
|
||||
retryDelay: effectiveDelay
|
||||
});
|
||||
await options.onFailedAttempt(context);
|
||||
if (calculateRemainingTime(startTime, maxRetryTime) <= 0) {
|
||||
abortIfNeeded();
|
||||
const remainingTime = calculateRemainingTime(startTime, options.maxRetryTime);
|
||||
if (!isRetriableError || remainingTime <= 0 || retriesLeft <= 0) {
|
||||
throw normalizedError;
|
||||
}
|
||||
const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
|
||||
if (remainingTime <= 0 || retriesLeft <= 0) {
|
||||
const shouldRetry = await options.shouldRetry(context);
|
||||
abortIfNeeded();
|
||||
if (!shouldRetry) {
|
||||
throw normalizedError;
|
||||
}
|
||||
if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
|
||||
throw normalizedError;
|
||||
}
|
||||
if (!await options.shouldRetry(context)) {
|
||||
throw normalizedError;
|
||||
}
|
||||
const remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, maxRetryTime);
|
||||
const remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, options.maxRetryTime);
|
||||
if (remainingTimeAfterShouldRetry <= 0) {
|
||||
throw normalizedError;
|
||||
}
|
||||
if (!consumeRetry) {
|
||||
options.signal?.throwIfAborted();
|
||||
return false;
|
||||
}
|
||||
const finalDelay = Math.min(effectiveDelay, remainingTimeAfterShouldRetry);
|
||||
options.signal?.throwIfAborted();
|
||||
await delayForRetry(finalDelay, options);
|
||||
options.signal?.throwIfAborted();
|
||||
await delayForRetry(Math.min(effectiveDelay, remainingTimeAfterShouldRetry), options);
|
||||
return true;
|
||||
}
|
||||
async function pRetry(input, options = {}) {
|
||||
options = { ...options };
|
||||
options.retries ??= 10;
|
||||
validateRetries(options.retries);
|
||||
if (Object.hasOwn(options, "forever")) {
|
||||
throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
|
||||
}
|
||||
options.retries ??= 10;
|
||||
options.factor ??= 2;
|
||||
options.minTimeout ??= 1e3;
|
||||
options.maxTimeout ??= Number.POSITIVE_INFINITY;
|
||||
options.maxRetryTime ??= Number.POSITIVE_INFINITY;
|
||||
options.maxTimeout ??= Infinity;
|
||||
options.maxRetryTime ??= Infinity;
|
||||
options.randomize ??= false;
|
||||
options.onFailedAttempt ??= () => {
|
||||
};
|
||||
options.shouldRetry ??= () => true;
|
||||
options.shouldConsumeRetry ??= () => true;
|
||||
validateFunctionOption("onFailedAttempt", options.onFailedAttempt);
|
||||
validateFunctionOption("shouldRetry", options.shouldRetry);
|
||||
validateFunctionOption("shouldConsumeRetry", options.shouldConsumeRetry);
|
||||
validateNumberOption("factor", options.factor, { min: 0, allowInfinity: false });
|
||||
validateNumberOption("minTimeout", options.minTimeout, { min: 0, allowInfinity: false });
|
||||
validateNumberOption("maxTimeout", options.maxTimeout, { min: 0, allowInfinity: true });
|
||||
validateNumberOption("maxRetryTime", options.maxRetryTime, { min: 0, allowInfinity: true });
|
||||
if (!(options.factor > 0)) {
|
||||
validateOption("onFailedAttempt", options.onFailedAttempt, "function");
|
||||
validateOption("shouldRetry", options.shouldRetry, "function");
|
||||
validateOption("shouldConsumeRetry", options.shouldConsumeRetry, "function");
|
||||
validateOption("randomize", options.randomize, "boolean");
|
||||
validateOption("unref", options.unref, "boolean");
|
||||
validateSignal(options.signal);
|
||||
validateNumberOption("factor", options.factor);
|
||||
validateNumberOption("minTimeout", options.minTimeout);
|
||||
validateNumberOption("maxTimeout", options.maxTimeout, { allowInfinity: true });
|
||||
validateNumberOption("maxRetryTime", options.maxRetryTime, { allowInfinity: true });
|
||||
if (options.factor === 0) {
|
||||
options.factor = 1;
|
||||
}
|
||||
options.signal?.throwIfAborted();
|
||||
let attemptNumber = 0;
|
||||
let retriesConsumed = 0;
|
||||
const startTime = performance.now();
|
||||
while (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {
|
||||
while (retriesConsumed <= options.retries) {
|
||||
attemptNumber++;
|
||||
try {
|
||||
options.signal?.throwIfAborted();
|
||||
|
||||
Generated
+5
-5
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "create-github-app-token",
|
||||
"version": "3.4.0",
|
||||
"version": "3.4.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "create-github-app-token",
|
||||
"version": "3.4.0",
|
||||
"version": "3.4.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.1",
|
||||
@@ -908,9 +908,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.1.2.tgz",
|
||||
"integrity": "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==",
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "create-github-app-token",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "3.4.0",
|
||||
"version": "3.4.1",
|
||||
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
||||
"engines": {
|
||||
"node": ">=24.4.0"
|
||||
|
||||
Reference in new issue
Block a user