Skip to content

Commit 5e1f078

Browse files
committed
dev-inf: Fix jq command to handle JSON array format
The execution file is a JSON array, not JSONL format. Updated all extraction steps to use '.[]' to iterate over the array before filtering by type. Changed from: jq -r 'select(.type == "result") | .result' Changed to: jq -r '.[] | select(.type == "result") | .result' This fixes the error: "Cannot index array with string 'type'" Epic: none Release note: none
1 parent 3c76919 commit 5e1f078

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
id: stage1_result
6767
if: steps.stage1.conclusion == 'success'
6868
run: |
69-
RESULT=$(jq -r 'select(.type == "result") | .result' "${{ steps.stage1.outputs.execution_file }}")
69+
RESULT=$(jq -r '.[] | select(.type == "result") | .result' "${{ steps.stage1.outputs.execution_file }}")
7070
{
7171
echo 'result<<EOF'
7272
echo "$RESULT"
@@ -116,7 +116,7 @@ jobs:
116116
id: stage2_result
117117
if: steps.stage2.conclusion == 'success'
118118
run: |
119-
RESULT=$(jq -r 'select(.type == "result") | .result' "${{ steps.stage2.outputs.execution_file }}")
119+
RESULT=$(jq -r '.[] | select(.type == "result") | .result' "${{ steps.stage2.outputs.execution_file }}")
120120
{
121121
echo 'result<<EOF'
122122
echo "$RESULT"
@@ -181,7 +181,7 @@ jobs:
181181
id: stage3_result
182182
if: steps.stage3.conclusion == 'success'
183183
run: |
184-
RESULT=$(jq -r 'select(.type == "result") | .result' "${{ steps.stage3.outputs.execution_file }}")
184+
RESULT=$(jq -r '.[] | select(.type == "result") | .result' "${{ steps.stage3.outputs.execution_file }}")
185185
{
186186
echo 'result<<EOF'
187187
echo "$RESULT"

0 commit comments

Comments
 (0)