Skip to content

Commit 2ba14c3

Browse files
committed
dev-inf: Fix stage chaining in Claude Code GH action
The claude-code-action doesn't export a 'result' output variable. Added extraction steps between each stage to: 1. Read the execution_file output from each stage 2. Parse the JSON to extract the result field 3. Set it as an output for the next stage's conditional This fixes the issue where Stage 2 and Stage 3 were being skipped even when bugs were detected in earlier stages. Epic: none Release note: none
1 parent 65bc4ed commit 2ba14c3

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

.github/workflows/pr-analyzer-threestage.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,17 @@ jobs:
6363
- `STAGE1_RESULT - POTENTIAL_BUG_DETECTED` or
6464
- `STAGE1_RESULT - NO_BUG_FOUND`
6565
66+
- name: Extract Stage 1 Result
67+
id: stage1_result
68+
if: steps.stage1.conclusion == 'success'
69+
run: |
70+
RESULT=$(cat "${{ steps.stage1.outputs.execution_file }}" | jq -r '.result' | tail -1)
71+
echo "result=$RESULT" >> $GITHUB_OUTPUT
72+
echo "Stage 1 result: $RESULT"
73+
6674
- name: Stage 2 - Database Expert Review
6775
id: stage2
68-
if: contains(steps.stage1.outputs.result, 'STAGE1_RESULT - POTENTIAL_BUG_DETECTED')
76+
if: contains(steps.stage1_result.outputs.result, 'STAGE1_RESULT - POTENTIAL_BUG_DETECTED')
6977
uses: cockroachdb/claude-code-action@v1
7078
env:
7179
ANTHROPIC_VERTEX_PROJECT_ID: vertex-model-runners
@@ -85,7 +93,7 @@ jobs:
8593
found potential issues. Your job is to confirm or reject those findings.
8694
8795
**Stage 1 Results**:
88-
${{ steps.stage1.outputs.result }}
96+
${{ steps.stage1_result.outputs.result }}
8997
9098
Review the Stage 1 findings and perform your own analysis. Do not identify
9199
new bugs unless they're glaringly obvious.
@@ -102,9 +110,17 @@ jobs:
102110
- `STAGE2_RESULT - POTENTIAL_BUG_DETECTED [detailed description of confirmed bugs]` or
103111
- `STAGE2_RESULT - NO_BUG_FOUND`
104112
113+
- name: Extract Stage 2 Result
114+
id: stage2_result
115+
if: steps.stage2.conclusion == 'success'
116+
run: |
117+
RESULT=$(cat "${{ steps.stage2.outputs.execution_file }}" | jq -r '.result' | tail -1)
118+
echo "result=$RESULT" >> $GITHUB_OUTPUT
119+
echo "Stage 2 result: $RESULT"
120+
105121
- name: Stage 3 - Principal Engineer Final Review
106122
id: stage3
107-
if: contains(steps.stage2.outputs.result, 'STAGE2_RESULT - POTENTIAL_BUG_DETECTED')
123+
if: contains(steps.stage2_result.outputs.result, 'STAGE2_RESULT - POTENTIAL_BUG_DETECTED')
108124
uses: cockroachdb/claude-code-action@v1
109125
env:
110126
ANTHROPIC_VERTEX_PROJECT_ID: vertex-model-runners
@@ -124,10 +140,10 @@ jobs:
124140
Two previous stages have found potential issues that need final validation.
125141
126142
**Stage 1 Results**:
127-
${{ steps.stage1.outputs.result }}
143+
${{ steps.stage1_result.outputs.result }}
128144
129145
**Stage 2 Results**:
130-
${{ steps.stage2.outputs.result }}
146+
${{ steps.stage2_result.outputs.result }}
131147
132148
This is the final gate before flagging this PR as having critical bugs.
133149
Only confirm bugs that could cause:
@@ -156,6 +172,14 @@ jobs:
156172
- `STAGE3_RESULT: POTENTIAL_BUG_CONFIRMED` or
157173
- `STAGE3_RESULT: NO_BUG_FOUND`
158174
175+
- name: Extract Stage 3 Result
176+
id: stage3_result
177+
if: steps.stage3.conclusion == 'success'
178+
run: |
179+
RESULT=$(cat "${{ steps.stage3.outputs.execution_file }}" | jq -r '.result' | tail -1)
180+
echo "result=$RESULT" >> $GITHUB_OUTPUT
181+
echo "Stage 3 result: $RESULT"
182+
159183
- name: Final Analysis Report
160184
if: always()
161185
uses: cockroachdb/claude-code-action@v1
@@ -176,9 +200,9 @@ jobs:
176200
177201
Generate a final summary report based on the completed analysis stages:
178202
179-
**Stage 1 Result**: ${{ steps.stage1.outputs.result || 'Not completed' }}
180-
**Stage 2 Result**: ${{ steps.stage2.outputs.result || 'Skipped - Stage 1 found no bugs' }}
181-
**Stage 3 Result**: ${{ steps.stage3.outputs.result || 'Skipped - Stage 2 did not confirm bugs' }}
203+
**Stage 1 Result**: ${{ steps.stage1_result.outputs.result || 'Not completed' }}
204+
**Stage 2 Result**: ${{ steps.stage2_result.outputs.result || 'Skipped - Stage 1 found no bugs' }}
205+
**Stage 3 Result**: ${{ steps.stage3_result.outputs.result || 'Skipped - Stage 2 did not confirm bugs' }}
182206
183207
**Analysis Process**:
184208
- Stage 1 (Initial Screening): ${{ steps.stage1.conclusion }}

0 commit comments

Comments
 (0)