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
|
# 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)
|
## [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.");
|
throw new TypeError("Expected `retries` to be a number or Infinity.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {
|
function validateNumberOption(name, value, { allowInfinity = false } = {}) {
|
||||||
if (value === void 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof value !== "number" || Number.isNaN(value)) {
|
if (typeof value !== "number" || Number.isNaN(value)) {
|
||||||
throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
|
throw new TypeError(`Expected \`${name}\` to be a number${allowInfinity ? " or Infinity" : ""}.`);
|
||||||
}
|
}
|
||||||
if (!allowInfinity && !Number.isFinite(value)) {
|
if (!allowInfinity && !Number.isFinite(value)) {
|
||||||
throw new TypeError(`Expected \`${name}\` to be a finite number.`);
|
throw new TypeError(`Expected \`${name}\` to be a finite number.`);
|
||||||
}
|
}
|
||||||
if (value < min) {
|
if (value < 0) {
|
||||||
throw new TypeError(`Expected \`${name}\` to be \u2265 ${min}.`);
|
throw new TypeError(`Expected \`${name}\` to be \u2265 0.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function validateFunctionOption(name, value) {
|
function validateOption(name, value, type) {
|
||||||
if (value === void 0) {
|
if (value === void 0 || value === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof value !== "function") {
|
if (typeof value !== type) {
|
||||||
throw new TypeError(`Expected \`${name}\` to be a function.`);
|
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) {
|
constructor(message) {
|
||||||
super();
|
super(typeof message === "string" ? message : void 0);
|
||||||
|
this.name = "AbortError";
|
||||||
if (message instanceof Error) {
|
if (message instanceof Error) {
|
||||||
this.originalError = message;
|
this.originalError = message;
|
||||||
({ message } = message);
|
({ message } = message);
|
||||||
} else {
|
} else {
|
||||||
this.originalError = new Error(message);
|
this.originalError = new Error(message);
|
||||||
this.originalError.stack = this.stack;
|
({ message } = this.originalError);
|
||||||
|
Error.captureStackTrace?.(this.originalError, _AbortError);
|
||||||
}
|
}
|
||||||
this.name = "AbortError";
|
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var maximumDelay = 2 ** 31 - 1;
|
||||||
function calculateDelay(retriesConsumed, options) {
|
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;
|
const random = options.randomize ? Math.random() + 1 : 1;
|
||||||
let timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
|
const timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));
|
||||||
timeout = Math.min(timeout, options.maxTimeout);
|
return Math.min(timeout, Math.ceil(options.maxTimeout), maximumDelay);
|
||||||
return timeout;
|
|
||||||
}
|
}
|
||||||
function calculateRemainingTime(start, max) {
|
function calculateRemainingTime(start, max) {
|
||||||
if (!Number.isFinite(max)) {
|
return Number.isFinite(max) ? max - (performance.now() - start) : max;
|
||||||
return max;
|
|
||||||
}
|
|
||||||
return max - (performance.now() - start);
|
|
||||||
}
|
}
|
||||||
async function delayForRetry(delay, options) {
|
async function delayForRetry(delay, options) {
|
||||||
if (delay <= 0) {
|
if (delay <= 0) {
|
||||||
@@ -23947,7 +23953,6 @@ async function delayForRetry(delay, options) {
|
|||||||
await new Promise((resolve2, reject) => {
|
await new Promise((resolve2, reject) => {
|
||||||
const onAbort = () => {
|
const onAbort = () => {
|
||||||
clearTimeout(timeoutToken);
|
clearTimeout(timeoutToken);
|
||||||
options.signal?.removeEventListener("abort", onAbort);
|
|
||||||
reject(options.signal.reason);
|
reject(options.signal.reason);
|
||||||
};
|
};
|
||||||
const timeoutToken = setTimeout(() => {
|
const timeoutToken = setTimeout(() => {
|
||||||
@@ -23960,35 +23965,43 @@ async function delayForRetry(delay, options) {
|
|||||||
options.signal?.addEventListener("abort", onAbort, { once: true });
|
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 }) {
|
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) {
|
if (normalizedError instanceof AbortError) {
|
||||||
throw normalizedError.originalError;
|
throw unwrapAbortError(normalizedError);
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
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({
|
const consumeRetryContext = Object.freeze({
|
||||||
error: normalizedError,
|
error: normalizedError,
|
||||||
attemptNumber,
|
attemptNumber,
|
||||||
retriesLeft,
|
retriesLeft,
|
||||||
retriesConsumed,
|
retriesConsumed,
|
||||||
retryDelay: retriesLeft > 0 ? delayTime : 0
|
retryDelay: delayTime
|
||||||
});
|
});
|
||||||
const consumeRetry = await options.shouldConsumeRetry(consumeRetryContext);
|
const consumeRetry = await options.shouldConsumeRetry(consumeRetryContext) ?? true;
|
||||||
const effectiveDelay = consumeRetry && retriesLeft > 0 ? delayTime : 0;
|
abortIfNeeded();
|
||||||
|
const effectiveDelay = consumeRetry ? delayTime : 0;
|
||||||
const context = Object.freeze({
|
const context = Object.freeze({
|
||||||
error: normalizedError,
|
error: normalizedError,
|
||||||
attemptNumber,
|
attemptNumber,
|
||||||
@@ -23997,64 +24010,60 @@ async function onAttemptFailure({ error: error2, attemptNumber, retriesConsumed,
|
|||||||
retryDelay: effectiveDelay
|
retryDelay: effectiveDelay
|
||||||
});
|
});
|
||||||
await options.onFailedAttempt(context);
|
await options.onFailedAttempt(context);
|
||||||
if (calculateRemainingTime(startTime, maxRetryTime) <= 0) {
|
abortIfNeeded();
|
||||||
|
const remainingTime = calculateRemainingTime(startTime, options.maxRetryTime);
|
||||||
|
if (!isRetriableError || remainingTime <= 0 || retriesLeft <= 0) {
|
||||||
throw normalizedError;
|
throw normalizedError;
|
||||||
}
|
}
|
||||||
const remainingTime = calculateRemainingTime(startTime, maxRetryTime);
|
const shouldRetry = await options.shouldRetry(context);
|
||||||
if (remainingTime <= 0 || retriesLeft <= 0) {
|
abortIfNeeded();
|
||||||
|
if (!shouldRetry) {
|
||||||
throw normalizedError;
|
throw normalizedError;
|
||||||
}
|
}
|
||||||
if (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {
|
const remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, options.maxRetryTime);
|
||||||
throw normalizedError;
|
|
||||||
}
|
|
||||||
if (!await options.shouldRetry(context)) {
|
|
||||||
throw normalizedError;
|
|
||||||
}
|
|
||||||
const remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, maxRetryTime);
|
|
||||||
if (remainingTimeAfterShouldRetry <= 0) {
|
if (remainingTimeAfterShouldRetry <= 0) {
|
||||||
throw normalizedError;
|
throw normalizedError;
|
||||||
}
|
}
|
||||||
if (!consumeRetry) {
|
if (!consumeRetry) {
|
||||||
options.signal?.throwIfAborted();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const finalDelay = Math.min(effectiveDelay, remainingTimeAfterShouldRetry);
|
await delayForRetry(Math.min(effectiveDelay, remainingTimeAfterShouldRetry), options);
|
||||||
options.signal?.throwIfAborted();
|
|
||||||
await delayForRetry(finalDelay, options);
|
|
||||||
options.signal?.throwIfAborted();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
async function pRetry(input, options = {}) {
|
async function pRetry(input, options = {}) {
|
||||||
options = { ...options };
|
options = { ...options };
|
||||||
|
options.retries ??= 10;
|
||||||
validateRetries(options.retries);
|
validateRetries(options.retries);
|
||||||
if (Object.hasOwn(options, "forever")) {
|
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.");
|
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.factor ??= 2;
|
||||||
options.minTimeout ??= 1e3;
|
options.minTimeout ??= 1e3;
|
||||||
options.maxTimeout ??= Number.POSITIVE_INFINITY;
|
options.maxTimeout ??= Infinity;
|
||||||
options.maxRetryTime ??= Number.POSITIVE_INFINITY;
|
options.maxRetryTime ??= Infinity;
|
||||||
options.randomize ??= false;
|
options.randomize ??= false;
|
||||||
options.onFailedAttempt ??= () => {
|
options.onFailedAttempt ??= () => {
|
||||||
};
|
};
|
||||||
options.shouldRetry ??= () => true;
|
options.shouldRetry ??= () => true;
|
||||||
options.shouldConsumeRetry ??= () => true;
|
options.shouldConsumeRetry ??= () => true;
|
||||||
validateFunctionOption("onFailedAttempt", options.onFailedAttempt);
|
validateOption("onFailedAttempt", options.onFailedAttempt, "function");
|
||||||
validateFunctionOption("shouldRetry", options.shouldRetry);
|
validateOption("shouldRetry", options.shouldRetry, "function");
|
||||||
validateFunctionOption("shouldConsumeRetry", options.shouldConsumeRetry);
|
validateOption("shouldConsumeRetry", options.shouldConsumeRetry, "function");
|
||||||
validateNumberOption("factor", options.factor, { min: 0, allowInfinity: false });
|
validateOption("randomize", options.randomize, "boolean");
|
||||||
validateNumberOption("minTimeout", options.minTimeout, { min: 0, allowInfinity: false });
|
validateOption("unref", options.unref, "boolean");
|
||||||
validateNumberOption("maxTimeout", options.maxTimeout, { min: 0, allowInfinity: true });
|
validateSignal(options.signal);
|
||||||
validateNumberOption("maxRetryTime", options.maxRetryTime, { min: 0, allowInfinity: true });
|
validateNumberOption("factor", options.factor);
|
||||||
if (!(options.factor > 0)) {
|
validateNumberOption("minTimeout", options.minTimeout);
|
||||||
|
validateNumberOption("maxTimeout", options.maxTimeout, { allowInfinity: true });
|
||||||
|
validateNumberOption("maxRetryTime", options.maxRetryTime, { allowInfinity: true });
|
||||||
|
if (options.factor === 0) {
|
||||||
options.factor = 1;
|
options.factor = 1;
|
||||||
}
|
}
|
||||||
options.signal?.throwIfAborted();
|
options.signal?.throwIfAborted();
|
||||||
let attemptNumber = 0;
|
let attemptNumber = 0;
|
||||||
let retriesConsumed = 0;
|
let retriesConsumed = 0;
|
||||||
const startTime = performance.now();
|
const startTime = performance.now();
|
||||||
while (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {
|
while (retriesConsumed <= options.retries) {
|
||||||
attemptNumber++;
|
attemptNumber++;
|
||||||
try {
|
try {
|
||||||
options.signal?.throwIfAborted();
|
options.signal?.throwIfAborted();
|
||||||
|
|||||||
Generated
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "create-github-app-token",
|
"name": "create-github-app-token",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "create-github-app-token",
|
"name": "create-github-app-token",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.1",
|
"@actions/core": "^3.0.1",
|
||||||
@@ -908,9 +908,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.1.2",
|
"version": "7.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
"integrity": "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==",
|
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"name": "create-github-app-token",
|
"name": "create-github-app-token",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.4.0",
|
"version": "3.4.1",
|
||||||
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=24.4.0"
|
"node": ">=24.4.0"
|
||||||
|
|||||||
Reference in new issue
Block a user