From 28c5415a3690e9ab9b153a50f2713bb404b7b67a Mon Sep 17 00:00:00 2001 From: stranske Date: Mon, 19 Jan 2026 05:31:36 +0000 Subject: [PATCH] fix: use compact JSON format in consumer activity step The workflow_counts and activity_json were being built with formatted output (jq -r) which included whitespace. This caused 'Invalid format' errors when writing to GITHUB_OUTPUT. Changes: - Use jq -c (compact) for workflow_counts - Use jq -cn for repo_json - Use jq -c when appending to activity_json - Add final jq -c compaction before output --- .github/workflows/health-75-api-rate-diagnostic.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/health-75-api-rate-diagnostic.yml b/.github/workflows/health-75-api-rate-diagnostic.yml index da9ed21ee..d3e705992 100644 --- a/.github/workflows/health-75-api-rate-diagnostic.yml +++ b/.github/workflows/health-75-api-rate-diagnostic.yml @@ -427,10 +427,10 @@ jobs: queued=$(echo "$runs_data" | jq '[.workflow_runs[] | select(.status == "queued")] | length') completed=$(echo "$runs_data" | jq '[.workflow_runs[] | select(.status == "completed")] | length') - # Get most common workflows - workflow_counts=$(echo "$runs_data" | jq -r '[.workflow_runs[].name] | group_by(.) | map({name: .[0], count: length}) | sort_by(-.count) | .[0:5]') + # Get most common workflows (use -c for compact output) + workflow_counts=$(echo "$runs_data" | jq -c '[.workflow_runs[].name] | group_by(.) | map({name: .[0], count: length}) | sort_by(-.count) | .[0:5]') - repo_json=$(jq -n \ + repo_json=$(jq -cn \ --arg repo "$repo" \ --argjson total_runs "$total_runs" \ --argjson in_progress "$in_progress" \ @@ -446,13 +446,14 @@ jobs: top_workflows: $workflows }') - activity_json=$(echo "$activity_json" | jq --argjson repo "$repo_json" '. + [$repo]') + activity_json=$(echo "$activity_json" | jq -c --argjson repo "$repo_json" '. + [$repo]') echo " Runs (last hour): $total_runs (in_progress: $in_progress, queued: $queued)" done <<< "$REGISTERED_CONSUMER_REPOS" - # Use single-line format to avoid heredoc parsing issues + # Compact the final JSON and output + activity_json=$(echo "$activity_json" | jq -c '.') printf 'activity_json=%s\n' "$activity_json" >> "$GITHUB_OUTPUT" echo "::endgroup::"