This commit is contained in:
David Blass
2025-11-06 19:37:31 -05:00
parent 854e3d5e4d
commit 42b023cc86
6 changed files with 91 additions and 129 deletions
+80 -81
View File
File diff suppressed because one or more lines are too long
-4
View File
@@ -7,16 +7,12 @@
import * as core from "@actions/core";
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";
// Export createMcpServer so it can be called from the spawned MCP process
export { createMcpServer };
async function run(): Promise<void> {
try {
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
const inputs: Inputs = {
prompt: core.getInput("prompt", { required: true }),
anthropic_api_key: core.getInput("anthropic_api_key") || undefined,
+8 -16
View File
@@ -1,6 +1,7 @@
import { type } from "arktype";
import { claude } from "./agents/claude.ts";
import { createMcpConfigs } from "./mcp/config.ts";
import packageJson from "./package.json" with { type: "json" };
import { log } from "./utils/cli.ts";
import { parseRepoContext, setupGitHubInstallationToken } from "./utils/github.ts";
import { setupGitAuth, setupGitConfig } from "./utils/setup.ts";
@@ -22,23 +23,14 @@ export type PromptJSON = {};
export async function main(inputs: Inputs): Promise<MainResult> {
try {
log.info("Starting agent run...");
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
// 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)}`
);
// Change to GITHUB_WORKSPACE if set (this is where actions/checkout puts the repo)
// JavaScript actions run from the action's directory, not the checked-out repo
if (process.env.GITHUB_WORKSPACE && process.cwd() !== process.env.GITHUB_WORKSPACE) {
log.debug(`Changing to GITHUB_WORKSPACE: ${process.env.GITHUB_WORKSPACE}`);
process.chdir(process.env.GITHUB_WORKSPACE);
log.debug(`New working directory: ${process.cwd()}`);
}
setupGitConfig();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pullfrog/action",
"version": "0.0.79",
"version": "0.0.80",
"type": "module",
"files": [
"index.js",
-3
View File
@@ -5,7 +5,6 @@ import { fromHere } from "@ark/fs";
import arg from "arg";
import { config } from "dotenv";
import { type Inputs, main } from "./main.ts";
import packageJson from "./package.json" with { type: "json" };
import { log } from "./utils/cli.ts";
import { setupTestRepo } from "./utils/setup.ts";
@@ -15,8 +14,6 @@ export async function run(
prompt: string
): Promise<{ success: boolean; output?: string | undefined; error?: string | undefined }> {
try {
log.info(`🐸 Running pullfrog/action@${packageJson.version}...`);
const tempDir = join(process.cwd(), ".temp");
setupTestRepo({ tempDir, forceClean: true });
+2 -24
View File
@@ -47,29 +47,7 @@ export function setupGitConfig(): void {
// Only set up git config in GitHub Actions environment
// In local development, use the user's existing git config
if (!process.env.GITHUB_ACTIONS) {
log.info("⚠️ Skipping git configuration setup (not in GitHub Actions)");
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
}
log.warning("Skipping git configuration setup (not in GitHub Actions)");
return;
}
@@ -95,7 +73,7 @@ export function setupGitAuth(githubToken: string, repoContext: RepoContext): voi
// Only set up git auth in GitHub Actions environment
// In local testing, this would overwrite the real git remote with fake credentials
if (!process.env.GITHUB_ACTIONS) {
log.info("⚠️ Skipping git authentication setup (not in GitHub Actions)");
log.warning("Skipping git authentication setup (not in GitHub Actions)");
return;
}