mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-04 21:52:14 +00:00
fix: better logging for gh token refresh
This commit is contained in:
parent
d9feebb89d
commit
005190e7bd
1 changed files with 3 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ const logger = createLogger(LogLevel.INFO, "GitHub-API");
|
||||||
|
|
||||||
async function getInstallationTokenAndUpdateConfig() {
|
async function getInstallationTokenAndUpdateConfig() {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Fetching a new GitHub installation token.");
|
||||||
const config = getConfig();
|
const config = getConfig();
|
||||||
const encryptionSecret = process.env.SECRETS_ENCRYPTION_KEY;
|
const encryptionSecret = process.env.SECRETS_ENCRYPTION_KEY;
|
||||||
if (!encryptionSecret) {
|
if (!encryptionSecret) {
|
||||||
|
|
@ -30,6 +31,7 @@ async function getInstallationTokenAndUpdateConfig() {
|
||||||
const token = await getInstallationToken(installationId, appId, privateKey);
|
const token = await getInstallationToken(installationId, appId, privateKey);
|
||||||
const encryptedToken = encryptSecret(token, encryptionSecret);
|
const encryptedToken = encryptSecret(token, encryptionSecret);
|
||||||
updateConfig(GITHUB_INSTALLATION_ID, encryptedToken);
|
updateConfig(GITHUB_INSTALLATION_ID, encryptedToken);
|
||||||
|
logger.info("Successfully fetched a new GitHub installation token.");
|
||||||
return token;
|
return token;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error("Failed to get installation token and update config", {
|
logger.error("Failed to get installation token and update config", {
|
||||||
|
|
@ -77,6 +79,7 @@ async function withGitHubRetry<T>(
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.error(errorMessage, {
|
logger.error(errorMessage, {
|
||||||
|
numRetries,
|
||||||
...additionalLogFields,
|
...additionalLogFields,
|
||||||
...(errorFields ?? { error }),
|
...(errorFields ?? { error }),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue