diff --git a/action.yml b/action.yml index 1024f95..d2924ac 100644 --- a/action.yml +++ b/action.yml @@ -160,7 +160,7 @@ runs: INPUT_PROMPT_FILE: ${{ runner.temp }}/claude-prompts/claude-prompt.txt INPUT_SETTINGS: ${{ inputs.settings }} INPUT_TIMEOUT_MINUTES: ${{ inputs.timeout_minutes }} - INPUT_CLAUDE_ARGS: ${{ inputs.claude_args }} + INPUT_CLAUDE_ARGS: ${{ steps.prepare.outputs.mcp_config_file && format('--mcp-config {0} {1}', steps.prepare.outputs.mcp_config_file, inputs.claude_args) || inputs.claude_args }} INPUT_EXPERIMENTAL_SLASH_COMMANDS_DIR: ${{ github.action_path }}/slash-commands # Model configuration diff --git a/src/entrypoints/prepare.ts b/src/entrypoints/prepare.ts index 5ddb84a..8682d7d 100644 --- a/src/entrypoints/prepare.ts +++ b/src/entrypoints/prepare.ts @@ -6,6 +6,7 @@ */ import * as core from "@actions/core"; +import { writeFile } from "fs/promises"; import { setupGitHubToken } from "../github/token"; import { checkWritePermissions } from "../github/validation/permissions"; import { createOctokit } from "../github/api/client"; @@ -57,8 +58,11 @@ async function run() { githubToken, }); - // Set the MCP config output + // Write MCP config to a file and set the file path as output + const mcpConfigPath = `${process.env.RUNNER_TEMP}/claude-mcp-config.json`; + await writeFile(mcpConfigPath, result.mcpConfig); core.setOutput("mcp_config", result.mcpConfig); + core.setOutput("mcp_config_file", mcpConfigPath); // Step 6: Get system prompt from mode if available if (mode.getSystemPrompt) { diff --git a/test/mockContext.ts b/test/mockContext.ts index 973cb60..802748a 100644 --- a/test/mockContext.ts +++ b/test/mockContext.ts @@ -27,8 +27,8 @@ const defaultRepository = { full_name: "test-owner/test-repo", }; -type MockContextOverrides = Omit, 'inputs'> & { - inputs?: Partial; +type MockContextOverrides = Omit, "inputs"> & { + inputs?: Partial; }; export const createMockContext = ( @@ -46,15 +46,15 @@ export const createMockContext = ( inputs: defaultInputs, }; - const mergedInputs = overrides.inputs + const mergedInputs = overrides.inputs ? { ...defaultInputs, ...overrides.inputs } : defaultInputs; return { ...baseContext, ...overrides, inputs: mergedInputs }; }; -type MockAutomationOverrides = Omit, 'inputs'> & { - inputs?: Partial; +type MockAutomationOverrides = Omit, "inputs"> & { + inputs?: Partial; }; export const createMockAutomationContext = ( @@ -70,7 +70,7 @@ export const createMockAutomationContext = ( inputs: defaultInputs, }; - const mergedInputs = overrides.inputs + const mergedInputs = overrides.inputs ? { ...defaultInputs, ...overrides.inputs } : defaultInputs;