Skip to content

Commit a311b3e

Browse files
mballanceCopilot
andcommitted
Fix inline python3: use heredoc to avoid YAML parse issues
Inline python3 -c strings with colons/quotes break YAML block scalars. Use a quoted heredoc (PYEOF) instead, consistent with the request-building step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9c7003a commit a311b3e

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/fvutils-weekly-report.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,22 +124,35 @@ jobs:
124124
print("Request JSON written.")
125125
PYEOF
126126
127-
curl -s -f \
127+
curl -s \
128128
-H "Authorization: Bearer $GH_TOKEN" \
129129
-H "Content-Type: application/json" \
130130
--data @/tmp/request.json \
131131
"$MODELS_ENDPOINT" \
132-
| python3 -c "import sys,json; print(json.load(sys.stdin)['choices'][0]['message']['content'])" \
133-
> /tmp/news_item.md 2>/tmp/api_error.txt \
134-
|| {
132+
> /tmp/api_response.json 2>/tmp/api_error.txt
133+
134+
echo "--- API response ---"
135+
cat /tmp/api_response.json
136+
137+
python3 << 'PYEOF'
138+
import sys, json
139+
data = json.load(open('/tmp/api_response.json'))
140+
if 'choices' in data:
141+
with open('/tmp/news_item.md', 'w') as f:
142+
f.write(data['choices'][0]['message']['content'])
143+
else:
144+
print('ERROR:', data, file=sys.stderr)
145+
sys.exit(1)
146+
PYEOF
147+
if [ $? -ne 0 ]; then
135148
echo "WARNING: GitHub Models API call failed:"
136149
cat /tmp/api_error.txt
137150
echo "Generating fallback news item..."
138151
printf "## fvutils Weekly Highlights — week ending %s\n\n" "$WEEK_END" > /tmp/news_item.md
139152
cat /tmp/activity.md >> /tmp/news_item.md
140153
echo "" >> /tmp/news_item.md
141154
echo "*Auto-generated from commit/PR/issue metadata — AI summarization unavailable.*" >> /tmp/news_item.md
142-
}
155+
fi
143156
144157
echo "=== Generated news item ==="
145158
cat /tmp/news_item.md

0 commit comments

Comments
 (0)