Skip to content

Commit 941879f

Browse files
Rome-1claude
andcommitted
fix(rf-cfjc): action.yml jq parser handles wrapped JSON shape
rafter ≥0.7.0 (since rf-0pch, 2026-04-27) wraps scan results as {_note, scan_mode, triage_applied, results: [...]} instead of a bare array. The composite action's count query [.[].matches[]] errored on the new shape and silently fell through to "0", causing the Test Composite Action 'detect secrets in fixture' job to fail with "expected findings > 0, got 0" — even though the scanner correctly detected the AKIA fixture. Use a type-aware query that handles both the wrapped object (current) and the bare array (older pinned versions). Verified against both shapes locally; CI run #25598398886 log shows the scanner already emits the correct match. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2205bfa commit 941879f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ runs:
9494
echo "${OUTPUT}" >> "$GITHUB_OUTPUT"
9595
echo "RAFTER_EOF" >> "$GITHUB_OUTPUT"
9696
97-
# Count findings from output
97+
# Count findings from output. rafter ≥0.7.0 wraps results in an object
98+
# ({_note, scan_mode, triage_applied, results: [...]}); older versions
99+
# emitted a bare array. Handle both so users pinning `version:` to an
100+
# older release don't break.
98101
if [ "${{ inputs.format }}" = "json" ]; then
99-
COUNT=$(echo "${OUTPUT}" | jq '[.[].matches[]] | length' 2>/dev/null || echo "0")
102+
COUNT=$(echo "${OUTPUT}" | jq '[(if type == "array" then . else .results end) | .[]?.matches[]?] | length' 2>/dev/null || echo "0")
100103
else
101104
COUNT=$(echo "${OUTPUT}" | grep -c 'Secret:' 2>/dev/null || echo "0")
102105
fi

0 commit comments

Comments
 (0)