Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/semantic_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,23 @@ jobs:
continue
fi

# Execute SFW diff (sfw handles its own sandboxing internally)
if ! OUTPUT=$(./bin/sfw diff "$OLD_FILE" "$NEW_FILE" 2>&1); then
# Execute SFW diff (sfw handles its own sandboxing internally).
# Capture STDOUT (the JSON report) only -- sfw writes warnings/errors
# to stderr (e.g. the "runsc not found, falling back" notice), and
# merging them with 2>&1 corrupts the JSON parsed below.
if ! OUTPUT=$(./bin/sfw diff "$OLD_FILE" "$NEW_FILE" 2>sfw_stderr.log); then
echo "::error::sfw failed to process $NEW_FILE_REF"
# Surface the tool's actual error instead of swallowing it.
printf '%s\n' "$OUTPUT" | sed 's/^/ [sfw] /'
sed 's/^/ [sfw] /' sfw_stderr.log
ERROR_COUNT=$((ERROR_COUNT + 1))
continue
fi

# Validate JSON
if ! echo "$OUTPUT" | jq -e . >/dev/null 2>&1; then
echo "::error::Invalid JSON output for $NEW_FILE_REF"
printf '%s\n' "$OUTPUT" | sed 's/^/ [sfw] /'
printf '%s\n' "$OUTPUT" | sed 's/^/ [out] /'
sed 's/^/ [sfw] /' sfw_stderr.log
ERROR_COUNT=$((ERROR_COUNT + 1))
continue
fi
Expand Down
Loading