Retries on oidc. 152

This commit is contained in:
Colin McDonnell
2025-12-22 14:33:18 -08:00
parent 2dea842981
commit 5353d80388
4 changed files with 41 additions and 12 deletions
+2 -2
View File
@@ -1,6 +1,7 @@
import { createSign } from "node:crypto";
import * as core from "@actions/core";
import { log } from "./cli.ts";
import { retry } from "./retry.ts";
export interface InstallationToken {
token: string;
@@ -56,7 +57,6 @@ async function acquireTokenViaOIDC(): Promise<string> {
log.info("» exchanging OIDC token for installation token...");
// Add timeout to prevent long waits (30 seconds)
const timeoutMs = 30000;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
@@ -234,7 +234,7 @@ async function acquireTokenViaGitHubApp(): Promise<string> {
async function acquireNewToken(): Promise<string> {
if (isGitHubActionsEnvironment()) {
return await acquireTokenViaOIDC();
return await retry(() => acquireTokenViaOIDC(), { label: "token exchange" });
} else {
return await acquireTokenViaGitHubApp();
}