diff --git a/.github/workflows/classify-issue-severity.yml b/.github/workflows/classify-issue-severity.yml index 0ec0236ab7451..0a90411776f57 100644 --- a/.github/workflows/classify-issue-severity.yml +++ b/.github/workflows/classify-issue-severity.yml @@ -31,6 +31,7 @@ jobs: uses: anthropics/claude-code-action@f0c8eb29807907de7f5412d04afceb5e24817127 # v1.0.23 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + claude_args: --json-schema '{"type":"object","properties":{"status":{"type":"string","enum":["classified","insufficient_info"]},"severity":{"type":"string","enum":["s0","s1","s2","s3","s4"]},"reasoning":{"type":"string"},"next_steps":{"type":"array","items":{"type":"string"}}},"required":["status","reasoning"],"allOf":[{"if":{"properties":{"status":{"const":"classified"}}},"then":{"required":["severity"]}},{"if":{"properties":{"status":{"const":"insufficient_info"}}},"then":{"required":["next_steps"]}}]}' prompt: | You are an expert software engineer triaging customer-reported issues for Coder, a cloud development environment platform. @@ -140,28 +141,20 @@ jobs: **Critical**: Output ONLY the JSON object, nothing else. The JSON will be parsed and validated. - - name: Extract Result from Execution File + - name: Extract Result from Structured Output id: extract env: - EXECUTION_FILE: ${{ steps.analysis.outputs.execution_file }} # zizmor: ignore[template-injection] + STRUCTURED_OUTPUT: ${{ steps.analysis.outputs.structured_output }} run: | - if [ ! -f "$EXECUTION_FILE" ]; then - echo "Execution file not found: $EXECUTION_FILE" - exit 1 - fi - - # The execution file is an array of conversation messages - # Extract the last assistant message's text content - RESULT=$(jq -r '.[].content[]? | select(.type == "text") | .text' < "$EXECUTION_FILE" | tail -n 1) - - if [ -z "$RESULT" ]; then - echo "No text content found in execution file" + if [ -z "$STRUCTURED_OUTPUT" ]; then + echo "No structured output returned from Claude" exit 1 fi + # The structured_output is already in JSON format matching our schema { echo "result<> "$GITHUB_OUTPUT"