fix: use structured output for classify-issue-severity workflow #21240
+7
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the extraction error in the
classify-issue-severity.ymlworkflow by using structured output instead of parsing the execution file.Root Cause
The claude-code-action uses its own stream-json format (not the Anthropic Messages API format). Without
--json-schema, the assistant's text response isn't available in a structured field in the execution file. The previous fix (#21238) tried to extract text fromcontentarrays, but that doesn't match the actual format.Solution
Use the claude-code-action's structured output feature:
Add
--json-schemaparameter with a JSON schema that matches the expected output formatstatus,reasoningstatusvaluestatusandseverityUse
structured_outputoutput directly from the claude-code-action--json-schemais providedSimplify extraction step
Changes
.github/workflows/classify-issue-severity.yml:claude_argswith--json-schemaparameterexecution_fileto usingstructured_outputVerification
The structured output approach is the recommended way to extract data from claude-code-action, as shown in their test workflows:
https://github.com/anthropics/claude-code-action/blob/main/.github/workflows/test-structured-output.yml
Supersedes
🤖 Generated with Claude Code