fix: dont require an installation ID in eval mode (#721)

This commit is contained in:
Brace Sproul 2025-08-08 12:36:28 -07:00 • committed by GitHub
parent 39a8ee67ee
commit daa042add2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,23 +24,24 @@ export function getGitHubTokensFromConfig(config: GraphConfig): {
const isProd = process.env.NODE_ENV === "production";
const installationId = config.configurable[GITHUB_INSTALLATION_ID];
if (!installationId) {
throw new Error(
`Missing required ${GITHUB_INSTALLATION_ID} in configuration.`,
);
}
const githubPat = getGitHubPatFromConfig(config.configurable, encryptionKey);
if (githubPat && !isProd) {
// check for PAT-only mode
return {
githubAccessToken: githubPat,
githubInstallationToken: githubPat,
installationId,
// installationId is not required in PAT-only mode
installationId: config.configurable[GITHUB_INSTALLATION_ID] ?? "",
};
}
const installationId = config.configurable[GITHUB_INSTALLATION_ID];
if (!installationId) {
throw new Error(
`Missing required ${GITHUB_INSTALLATION_ID} in configuration.`,
);
}
const encryptedGitHubToken = config.configurable[GITHUB_TOKEN_COOKIE];
const encryptedInstallationToken =
config.configurable[GITHUB_INSTALLATION_TOKEN_COOKIE];