add debug

This commit is contained in:
David Blass
2025-11-06 19:19:26 -05:00
parent 5bb1b779a8
commit 854e3d5e4d
4 changed files with 123 additions and 74 deletions
+72 -71
View File
File diff suppressed because one or more lines are too long
+17
View File
@@ -24,6 +24,23 @@ export async function main(inputs: Inputs): Promise<MainResult> {
try {
log.info("Starting agent run...");
// Debug logging for git repo detection
log.debug(`Current working directory: ${process.cwd()}`);
log.debug(`GITHUB_ACTIONS: ${process.env.GITHUB_ACTIONS}`);
log.debug(`GITHUB_WORKSPACE: ${process.env.GITHUB_WORKSPACE}`);
try {
const { execSync } = await import("node:child_process");
const gitDir = execSync("git rev-parse --git-dir", {
encoding: "utf-8",
stdio: "pipe",
}).trim();
log.debug(`Git directory found: ${gitDir}`);
} catch (error) {
log.debug(
`Git directory check failed: ${error instanceof Error ? error.message : String(error)}`
);
}
setupGitConfig();
const githubInstallationToken = await setupGitHubInstallationToken();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pullfrog/action",
"version": "0.0.78",
"version": "0.0.79",
"type": "module",
"files": [
"index.js",
+33 -2
View File
@@ -51,9 +51,40 @@ export function setupGitConfig(): void {
return;
}
// Debug logging for git repo detection
log.debug(`setupGitConfig: Current working directory: ${process.cwd()}`);
log.debug(`setupGitConfig: GITHUB_WORKSPACE: ${process.env.GITHUB_WORKSPACE}`);
// Check if we're in a git repository before trying to set config
log.debug(`setupGitConfig: Checking for git repository...`);
try {
const gitDir = execSync("git rev-parse --git-dir", { encoding: "utf-8", stdio: "pipe" }).trim();
log.debug(`setupGitConfig: Git directory found: ${gitDir}`);
} catch (error) {
log.warning(
`⚠️ Skipping git configuration setup (not in a git repository): ${error instanceof Error ? error.message : String(error)}`
);
try {
const dirContents = execSync("ls -la", { encoding: "utf-8", stdio: "pipe" }).trim();
log.debug(`setupGitConfig: Current directory contents:\n${dirContents}`);
} catch {
// Ignore if ls fails
}
return;
}
log.info("🔧 Setting up git configuration...");
execSync('git config user.email "action@pullfrog.ai"', { stdio: "inherit" });
execSync('git config user.name "Pullfrog Action"', { stdio: "inherit" });
try {
execSync('git config user.email "action@pullfrog.ai"', { stdio: "pipe" });
execSync('git config user.name "Pullfrog Action"', { stdio: "pipe" });
log.debug("setupGitConfig: ✓ Git configuration set successfully");
} catch (error) {
// If git config fails, log warning but don't fail the action
// This can happen if we're not in a git repo or git isn't available
log.warning(
`Failed to set git config: ${error instanceof Error ? error.message : String(error)}`
);
}
}
/**