diff --git a/src/hook.ts b/src/hook.ts index e1ba4262f..95815e7e0 100644 --- a/src/hook.ts +++ b/src/hook.ts @@ -63,7 +63,7 @@ export async function hook( const diff = Math.floor( (Date.parse(error.response.headers.date) - Date.parse(new Date().toString())) / - 1000, + 1000, ); state.log.warn(error.message); @@ -92,7 +92,7 @@ export async function hook( state, // @ts-expect-error TBD {}, - request, + request.defaults({ baseUrl: endpoint.baseUrl }), ); endpoint.headers.authorization = `token ${token}`; @@ -131,9 +131,8 @@ async function sendRequestWithRetries( if (timeSinceTokenCreationInMs >= FIVE_SECONDS_IN_MS) { if (retries > 0) { - error.message = `After ${retries} retries within ${ - timeSinceTokenCreationInMs / 1000 - }s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`; + error.message = `After ${retries} retries within ${timeSinceTokenCreationInMs / 1000 + }s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`; } throw error; } @@ -142,8 +141,7 @@ async function sendRequestWithRetries( const awaitTime = retries * 1000; state.log.warn( - `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${ - awaitTime / 1000 + `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1000 }s)`, ); await new Promise((resolve) => setTimeout(resolve, awaitTime));