Skip to content

Commit bd7231d

Browse files
avrabeclaude
andcommitted
fix: properly separate JSON output from Bazel logs in workflow
Redirect stdout (JSON results) and stderr (Bazel logs) to separate files so that jq can cleanly parse the JSON without log noise. Also save and display logs for debugging purposes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent d0317c9 commit bd7231d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

.github/workflows/weekly-checksum-update.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,19 @@ jobs:
9393
9494
echo "Running checksum updater with tools: $TOOLS"
9595
96-
# Run the updater and capture output (stderr to stdout is visible, stdout to file for JSON parsing)
96+
# Run the updater and capture output
97+
# Capture stdout (JSON results) separately from stderr (logs/errors)
9798
if [ "$TOOLS" = "all" ]; then
98-
bazel run //tools/checksum_updater:checksum_updater_bin -- update-all $FORCE_FLAG $DRY_RUN_FLAG --output-format json 2>&1 | tail -n 1 > update_results.json
99+
bazel run //tools/checksum_updater:checksum_updater_bin -- update-all $FORCE_FLAG $DRY_RUN_FLAG --output-format json > update_results.json 2>update_logs.txt || true
99100
else
100-
bazel run //tools/checksum_updater:checksum_updater_bin -- update --tools "$TOOLS" $FORCE_FLAG $DRY_RUN_FLAG --output-format json 2>&1 | tail -n 1 > update_results.json
101+
bazel run //tools/checksum_updater:checksum_updater_bin -- update --tools "$TOOLS" $FORCE_FLAG $DRY_RUN_FLAG --output-format json > update_results.json 2>update_logs.txt || true
101102
fi
102103
104+
# Show logs for debugging
105+
echo "=== Update Tool Logs ==="
106+
cat update_logs.txt || true
107+
echo "=== End Logs ==="
108+
103109
# Check if any updates were made
104110
UPDATES_COUNT=$(jq '.summary.tools_updated' update_results.json)
105111
NEW_VERSIONS_COUNT=$(jq '.summary.new_versions_found' update_results.json)
@@ -112,8 +118,8 @@ jobs:
112118
# Store results for later steps
113119
cp update_results.json ./update_results.json
114120
115-
# Generate summary for PR description (suppress Bazel logs, keep only command output)
116-
bazel run //tools/checksum_updater:checksum_updater_bin -- generate-summary update_results.json 2>&1 | tail -n +1 | grep -v "^INFO\|^WARN\|^ERROR\|^Computing\|^Loading\|^Analyzing\|^Target\|^INFO:" > ./update_summary.md || true
121+
# Generate summary for PR description
122+
bazel run //tools/checksum_updater:checksum_updater_bin -- generate-summary update_results.json > ./update_summary.md 2>>/dev/null || true
117123
118124
- name: Validate updated checksums
119125
if: steps.update.outputs.updates_count > 0

0 commit comments

Comments
 (0)