Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 854e3d5e4d | |||
| 5bb1b779a8 |
@@ -5,8 +5,7 @@
|
||||
*/
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import { type } from "arktype";
|
||||
import { Inputs, main } from "./main.ts";
|
||||
import { type Inputs, main } from "./main.ts";
|
||||
import { createMcpServer } from "./mcp/server.ts";
|
||||
import packageJson from "./package.json" with { type: "json" };
|
||||
import { log } from "./utils/cli.ts";
|
||||
@@ -18,13 +17,10 @@ async function run(): Promise<void> {
|
||||
try {
|
||||
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
|
||||
|
||||
const inputsJson = process.env.INPUTS_JSON;
|
||||
if (!inputsJson) {
|
||||
throw new Error("INPUTS_JSON environment variable not found");
|
||||
}
|
||||
|
||||
const parsed = type("string.json.parse").assert(inputsJson);
|
||||
const inputs = Inputs.assert(parsed);
|
||||
const inputs: Inputs = {
|
||||
prompt: core.getInput("prompt", { required: true }),
|
||||
anthropic_api_key: core.getInput("anthropic_api_key") || undefined,
|
||||
};
|
||||
|
||||
const result = await main(inputs);
|
||||
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pullfrog/action",
|
||||
"version": "0.0.77",
|
||||
"version": "0.0.79",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"index.js",
|
||||
|
||||
+33
-2
@@ -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)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user