Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9567d84442 | |||
| d79564db5e | |||
| a7a0e87fd8 | |||
| 7050b8de75 | |||
| 2fc3ddee16 | |||
| 284d9733dd | |||
| 94e2b5f6e0 | |||
| 03810d574e | |||
| f52e94c612 | |||
| 9444a0e208 | |||
| 2296060d04 |
@@ -34,7 +34,7 @@ jobs:
|
|||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --no-frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Get package version
|
- name: Get package version
|
||||||
id: version
|
id: version
|
||||||
|
|||||||
+6
-2
@@ -1,6 +1,10 @@
|
|||||||
|
# Ensure lockfile is up to date
|
||||||
|
echo "🔒 Updating lockfile..."
|
||||||
|
pnpm install --lockfile-only
|
||||||
|
|
||||||
# Build the action before committing
|
# Build the action before committing
|
||||||
echo "🔨 Building action..."
|
echo "🔨 Building action..."
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
# Add the built files to the commit
|
# Add the built files and lockfile to the commit
|
||||||
git add entry.cjs
|
git add entry.cjs pnpm-lock.yaml
|
||||||
|
|||||||
+18
-2
@@ -18,8 +18,24 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "node20"
|
using: "composite"
|
||||||
main: "entry.cjs"
|
steps:
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
- name: Setup Node.js 24
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
cache: "pnpm"
|
||||||
|
cache-dependency-path: ${{ github.action_path }}/pnpm-lock.yaml
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ github.action_path }}
|
||||||
|
- name: Run agent
|
||||||
|
run: node entry.ts
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{ github.action_path }}
|
||||||
|
|
||||||
branding:
|
branding:
|
||||||
icon: "code"
|
icon: "code"
|
||||||
|
|||||||
@@ -7,10 +7,12 @@
|
|||||||
|
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import { type ExecutionInputs, type MainParams, main } from "./main.ts";
|
import { type ExecutionInputs, type MainParams, main } from "./main.ts";
|
||||||
|
import packageJson from "./package.json" with { type: "json" };
|
||||||
import { setupGitHubInstallationToken } from "./utils/github.ts";
|
import { setupGitHubInstallationToken } from "./utils/github.ts";
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
console.log(`🐸 Running pullfrog/action@${packageJson.version}...`);
|
||||||
const prompt = core.getInput("prompt", { required: true });
|
const prompt = core.getInput("prompt", { required: true });
|
||||||
const anthropic_api_key = core.getInput("anthropic_api_key");
|
const anthropic_api_key = core.getInput("anthropic_api_key");
|
||||||
|
|
||||||
@@ -44,7 +46,6 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
const result = await main(params);
|
const result = await main(params);
|
||||||
|
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
throw new Error(result.error || "Agent execution failed");
|
throw new Error(result.error || "Agent execution failed");
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -1,7 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Simple MCP configuration helper for adding our minimal GitHub comment server
|
* Simple MCP configuration helper for adding our minimal GitHub comment server
|
||||||
*/
|
*/
|
||||||
const actionPath = process.env.GITHUB_ACTION_PATH || process.cwd();
|
// const actionPath = process.env.GITHUB_ACTION_PATH || process.cwd();
|
||||||
|
|
||||||
|
import { fromHere } from "@ark/fs";
|
||||||
|
|
||||||
|
const actionPath = fromHere("..");
|
||||||
|
|
||||||
export function createMcpConfig(githubInstallationToken: string) {
|
export function createMcpConfig(githubInstallationToken: string) {
|
||||||
const githubRepository = process.env.GITHUB_REPOSITORY;
|
const githubRepository = process.env.GITHUB_REPOSITORY;
|
||||||
|
|||||||
+3
-14
@@ -6,7 +6,6 @@ import { Octokit } from "@octokit/rest";
|
|||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { resolveRepoContext } from "../utils/repo-context.ts";
|
import { resolveRepoContext } from "../utils/repo-context.ts";
|
||||||
import { writeFileSync } from "fs";
|
|
||||||
|
|
||||||
const server = new McpServer({
|
const server = new McpServer({
|
||||||
name: "Minimal GitHub Issue Comment Server",
|
name: "Minimal GitHub Issue Comment Server",
|
||||||
@@ -32,9 +31,7 @@ server.tool(
|
|||||||
|
|
||||||
const githubInstallationToken = process.env.GITHUB_INSTALLATION_TOKEN;
|
const githubInstallationToken = process.env.GITHUB_INSTALLATION_TOKEN;
|
||||||
if (!githubInstallationToken) {
|
if (!githubInstallationToken) {
|
||||||
throw new Error(
|
throw new Error("GITHUB_INSTALLATION_TOKEN environment variable is required");
|
||||||
"GITHUB_INSTALLATION_TOKEN environment variable is required"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve repository context from environment
|
// Resolve repository context from environment
|
||||||
@@ -69,8 +66,7 @@ server.tool(
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMessage =
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
error instanceof Error ? error.message : String(error);
|
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
@@ -93,11 +89,4 @@ async function runServer() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
runServer().catch((error) => {
|
await runServer();
|
||||||
// Write error to file for GitHub Actions visibility
|
|
||||||
try {
|
|
||||||
writeFileSync('/tmp/mcp-error.log', `${new Date().toISOString()} MCP Server Error: ${error.message}\nStack: ${error.stack}\n`, { flag: 'a' });
|
|
||||||
} catch {}
|
|
||||||
console.error('MCP Server Error:', error);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pullfrog/action",
|
"name": "@pullfrog/action",
|
||||||
"version": "0.0.24",
|
"version": "0.0.35",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
"createLockfile": "pnpm --ignore-workspace install"
|
"createLockfile": "pnpm --ignore-workspace install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ark/fs": "0.49.0",
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@modelcontextprotocol/sdk": "^1.17.5",
|
"@modelcontextprotocol/sdk": "^1.17.5",
|
||||||
"@octokit/rest": "^22.0.0",
|
"@octokit/rest": "^22.0.0",
|
||||||
@@ -34,7 +35,8 @@
|
|||||||
"arktype": "^2.1.22",
|
"arktype": "^2.1.22",
|
||||||
"dotenv": "^17.2.2",
|
"dotenv": "^17.2.2",
|
||||||
"execa": "^9.6.0",
|
"execa": "^9.6.0",
|
||||||
"table": "^6.9.0"
|
"table": "^6.9.0",
|
||||||
|
"zod": "^3.24.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.10.0",
|
"@types/node": "^20.10.0",
|
||||||
@@ -42,8 +44,7 @@
|
|||||||
"esbuild": "^0.25.9",
|
"esbuild": "^0.25.9",
|
||||||
"husky": "^9.0.0",
|
"husky": "^9.0.0",
|
||||||
"typescript": "^5.3.0",
|
"typescript": "^5.3.0",
|
||||||
"zshy": "^0.4.1",
|
"zshy": "^0.4.1"
|
||||||
"zod": "^3.24.4"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
import { existsSync, readFileSync } from "node:fs";
|
import { existsSync, readFileSync } from "node:fs";
|
||||||
import { dirname, extname, join, resolve } from "node:path";
|
import { extname, join, resolve } from "node:path";
|
||||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
import { pathToFileURL } from "node:url";
|
||||||
|
import { fromHere } from "@ark/fs";
|
||||||
import arg from "arg";
|
import arg from "arg";
|
||||||
import { config } from "dotenv";
|
import { config } from "dotenv";
|
||||||
import { main } from "./main.ts";
|
import { main } from "./main.ts";
|
||||||
|
import packageJson from "./package.json" with { type: "json" };
|
||||||
import { runAct } from "./utils/act.ts";
|
import { runAct } from "./utils/act.ts";
|
||||||
import { setupGitHubInstallationToken } from "./utils/github.ts";
|
import { setupGitHubInstallationToken } from "./utils/github.ts";
|
||||||
import { setupTestRepo } from "./utils/setup.ts";
|
import { setupTestRepo } from "./utils/setup.ts";
|
||||||
|
|
||||||
config();
|
config();
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = dirname(__filename);
|
|
||||||
|
|
||||||
export async function run(
|
export async function run(
|
||||||
prompt: string,
|
prompt: string,
|
||||||
options: { act?: boolean } = {}
|
options: { act?: boolean } = {}
|
||||||
): Promise<{ success: boolean; output?: string | undefined; error?: string | undefined }> {
|
): Promise<{ success: boolean; output?: string | undefined; error?: string | undefined }> {
|
||||||
try {
|
try {
|
||||||
|
console.log(`🐸 Running pullfrog/action@${packageJson.version}...`);
|
||||||
if (options.act) {
|
if (options.act) {
|
||||||
console.log("🐳 Running with Docker/act...");
|
console.log("🐳 Running with Docker/act...");
|
||||||
runAct(prompt);
|
runAct(prompt);
|
||||||
@@ -129,7 +129,7 @@ Examples:
|
|||||||
const ext = extname(filePath).toLowerCase();
|
const ext = extname(filePath).toLowerCase();
|
||||||
let resolvedPath: string;
|
let resolvedPath: string;
|
||||||
|
|
||||||
const fixturesPath = join(__dirname, "fixtures", filePath);
|
const fixturesPath = fromHere("fixtures", filePath);
|
||||||
if (existsSync(fixturesPath)) {
|
if (existsSync(fixturesPath)) {
|
||||||
resolvedPath = fixturesPath;
|
resolvedPath = fixturesPath;
|
||||||
} else if (existsSync(filePath)) {
|
} else if (existsSync(filePath)) {
|
||||||
|
|||||||
Generated
+11
-3
@@ -11,6 +11,9 @@ importers:
|
|||||||
'@actions/core':
|
'@actions/core':
|
||||||
specifier: ^1.11.1
|
specifier: ^1.11.1
|
||||||
version: 1.11.1
|
version: 1.11.1
|
||||||
|
'@ark/fs':
|
||||||
|
specifier: 0.49.0
|
||||||
|
version: 0.49.0
|
||||||
'@modelcontextprotocol/sdk':
|
'@modelcontextprotocol/sdk':
|
||||||
specifier: ^1.17.5
|
specifier: ^1.17.5
|
||||||
version: 1.19.1
|
version: 1.19.1
|
||||||
@@ -32,6 +35,9 @@ importers:
|
|||||||
table:
|
table:
|
||||||
specifier: ^6.9.0
|
specifier: ^6.9.0
|
||||||
version: 6.9.0
|
version: 6.9.0
|
||||||
|
zod:
|
||||||
|
specifier: ^3.24.4
|
||||||
|
version: 3.25.76
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^20.10.0
|
specifier: ^20.10.0
|
||||||
@@ -48,9 +54,6 @@ importers:
|
|||||||
typescript:
|
typescript:
|
||||||
specifier: ^5.3.0
|
specifier: ^5.3.0
|
||||||
version: 5.9.3
|
version: 5.9.3
|
||||||
zod:
|
|
||||||
specifier: ^3.24.4
|
|
||||||
version: 3.25.76
|
|
||||||
zshy:
|
zshy:
|
||||||
specifier: ^0.4.1
|
specifier: ^0.4.1
|
||||||
version: 0.4.3(typescript@5.9.3)
|
version: 0.4.3(typescript@5.9.3)
|
||||||
@@ -69,6 +72,9 @@ packages:
|
|||||||
'@actions/io@1.1.3':
|
'@actions/io@1.1.3':
|
||||||
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
|
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
|
||||||
|
|
||||||
|
'@ark/fs@0.49.0':
|
||||||
|
resolution: {integrity: sha512-AEjAQS/bu1CGIRiKK/XLaQ73cSJHixfexq28wNt+kBpQ0h1RwVIVzaGsn/+5IWw6DEbR7LB+3hil5gzrzEeyZQ==}
|
||||||
|
|
||||||
'@ark/schema@0.49.0':
|
'@ark/schema@0.49.0':
|
||||||
resolution: {integrity: sha512-GphZBLpW72iS0v4YkeUtV3YIno35Gimd7+ezbPO9GwEi9kzdUrPVjvf6aXSBAfHikaFc/9pqZOpv3pOXnC71tw==}
|
resolution: {integrity: sha512-GphZBLpW72iS0v4YkeUtV3YIno35Gimd7+ezbPO9GwEi9kzdUrPVjvf6aXSBAfHikaFc/9pqZOpv3pOXnC71tw==}
|
||||||
|
|
||||||
@@ -902,6 +908,8 @@ snapshots:
|
|||||||
|
|
||||||
'@actions/io@1.1.3': {}
|
'@actions/io@1.1.3': {}
|
||||||
|
|
||||||
|
'@ark/fs@0.49.0': {}
|
||||||
|
|
||||||
'@ark/schema@0.49.0':
|
'@ark/schema@0.49.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ark/util': 0.49.0
|
'@ark/util': 0.49.0
|
||||||
|
|||||||
Reference in New Issue
Block a user