Clean up msgs

This commit is contained in:
Colin McDonnell
2025-09-10 15:01:45 -07:00
parent 5c8b03a427
commit 70b365fca1
2 changed files with 332 additions and 327 deletions
+323 -322
View File
File diff suppressed because one or more lines are too long
+9 -5
View File
@@ -7,14 +7,16 @@ export async function setupGitHubInstallationToken(): Promise<string> {
// Check if we have an installation token from inputs or environment // Check if we have an installation token from inputs or environment
const inputToken = core.getInput("github_installation_token"); const inputToken = core.getInput("github_installation_token");
const envToken = process.env.GITHUB_INSTALLATION_TOKEN; const envToken = process.env.GITHUB_INSTALLATION_TOKEN;
const existingToken = inputToken || envToken; const existingToken = inputToken || envToken;
if (existingToken) { if (existingToken) {
// Mask the existing token in logs for security
core.setSecret(existingToken);
core.info("Using provided GitHub installation token"); core.info("Using provided GitHub installation token");
return existingToken; return existingToken;
} }
core.info("No cached installation token found, generating OIDC token..."); core.info("Generating OIDC token...");
try { try {
// Generate OIDC token for our API // Generate OIDC token for our API
@@ -24,6 +26,7 @@ export async function setupGitHubInstallationToken(): Promise<string> {
// Exchange OIDC token for installation token // Exchange OIDC token for installation token
const apiUrl = process.env.API_URL || "https://pullfrog.ai"; const apiUrl = process.env.API_URL || "https://pullfrog.ai";
core.info("Exchanging OIDC token for installation token...");
const tokenResponse = await fetch(`${apiUrl}/api/github/installation-token`, { const tokenResponse = await fetch(`${apiUrl}/api/github/installation-token`, {
method: "POST", method: "POST",
headers: { headers: {
@@ -40,9 +43,10 @@ export async function setupGitHubInstallationToken(): Promise<string> {
} }
const tokenData = await tokenResponse.json(); const tokenData = await tokenResponse.json();
core.info( core.info(`Installation token obtained for ${tokenData.repository || "all repositories"}`);
`Installation token obtained for ${tokenData.owner}/${tokenData.repository || "all repositories"}`
); // Mask the token in logs for security
core.setSecret(tokenData.token);
// Set the token as an environment variable for this run // Set the token as an environment variable for this run
process.env.GITHUB_INSTALLATION_TOKEN = tokenData.token; process.env.GITHUB_INSTALLATION_TOKEN = tokenData.token;