mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
update
This commit is contained in:
@@ -77,11 +77,6 @@ inputs:
|
|||||||
or the action will fail. All fields are returned in a single structured_output JSON string.
|
or the action will fail. All fields are returned in a single structured_output JSON string.
|
||||||
|
|
||||||
Access outputs via: fromJSON(steps.<step-id>.outputs.structured_output).<field_name>
|
Access outputs via: fromJSON(steps.<step-id>.outputs.structured_output).<field_name>
|
||||||
|
|
||||||
Limitations:
|
|
||||||
- All fields are returned in a single structured_output JSON string
|
|
||||||
- Field names can use any valid JSON property name (including hyphens, special characters, etc.)
|
|
||||||
- The entire structured_output string is limited to 1MB
|
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,6 @@ const PIPE_PATH = `${process.env.RUNNER_TEMP}/claude_prompt_pipe`;
|
|||||||
const EXECUTION_FILE = `${process.env.RUNNER_TEMP}/claude-execution-output.json`;
|
const EXECUTION_FILE = `${process.env.RUNNER_TEMP}/claude-execution-output.json`;
|
||||||
const BASE_ARGS = ["--verbose", "--output-format", "stream-json"];
|
const BASE_ARGS = ["--verbose", "--output-format", "stream-json"];
|
||||||
|
|
||||||
type ExecutionMessage = {
|
|
||||||
type: string;
|
|
||||||
structured_output?: Record<string, unknown>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sanitizes JSON output to remove sensitive information when full output is disabled
|
* Sanitizes JSON output to remove sensitive information when full output is disabled
|
||||||
* Returns a safe summary message or null if the message should be completely suppressed
|
* Returns a safe summary message or null if the message should be completely suppressed
|
||||||
@@ -137,9 +132,13 @@ export async function parseAndSetStructuredOutputs(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const content = await readFile(executionFile, "utf-8");
|
const content = await readFile(executionFile, "utf-8");
|
||||||
const messages = JSON.parse(content) as ExecutionMessage[];
|
const messages = JSON.parse(content) as {
|
||||||
|
type: string;
|
||||||
|
structured_output?: Record<string, unknown>;
|
||||||
|
}[];
|
||||||
|
|
||||||
const result = messages.find(
|
// Search backwards - result is typically last or second-to-last message
|
||||||
|
const result = messages.findLast(
|
||||||
(m) => m.type === "result" && m.structured_output,
|
(m) => m.type === "result" && m.structured_output,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user