mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
fix: prevent undefined directory creation when RUNNER_TEMP is not set (#461)
When running tests locally, process.env.RUNNER_TEMP is undefined, causing the code to literally create "undefined/claude-prompts/" directories in the working directory. Added fallback to "/tmp" following the pattern already used in src/mcp/github-actions-server.ts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -836,7 +836,7 @@ export async function createPrompt(
|
|||||||
modeContext.claudeBranch,
|
modeContext.claudeBranch,
|
||||||
);
|
);
|
||||||
|
|
||||||
await mkdir(`${process.env.RUNNER_TEMP}/claude-prompts`, {
|
await mkdir(`${process.env.RUNNER_TEMP || "/tmp"}/claude-prompts`, {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ export async function createPrompt(
|
|||||||
|
|
||||||
// Write the prompt file
|
// Write the prompt file
|
||||||
await writeFile(
|
await writeFile(
|
||||||
`${process.env.RUNNER_TEMP}/claude-prompts/claude-prompt.txt`,
|
`${process.env.RUNNER_TEMP || "/tmp"}/claude-prompts/claude-prompt.txt`,
|
||||||
promptContent,
|
promptContent,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export const agentMode: Mode = {
|
|||||||
|
|
||||||
// TODO: handle by createPrompt (similar to tag and review modes)
|
// TODO: handle by createPrompt (similar to tag and review modes)
|
||||||
// Create prompt directory
|
// Create prompt directory
|
||||||
await mkdir(`${process.env.RUNNER_TEMP}/claude-prompts`, {
|
await mkdir(`${process.env.RUNNER_TEMP || "/tmp"}/claude-prompts`, {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
// Write the prompt file - the base action requires a prompt_file parameter,
|
// Write the prompt file - the base action requires a prompt_file parameter,
|
||||||
@@ -57,7 +57,7 @@ export const agentMode: Mode = {
|
|||||||
context.inputs.directPrompt ||
|
context.inputs.directPrompt ||
|
||||||
`Repository: ${context.repository.owner}/${context.repository.repo}`;
|
`Repository: ${context.repository.owner}/${context.repository.repo}`;
|
||||||
await writeFile(
|
await writeFile(
|
||||||
`${process.env.RUNNER_TEMP}/claude-prompts/claude-prompt.txt`,
|
`${process.env.RUNNER_TEMP || "/tmp"}/claude-prompts/claude-prompt.txt`,
|
||||||
promptContent,
|
promptContent,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user