Compare commits

...

1 Commits

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