Skip to content

Commit 1e07dd1

Browse files
mballanceCopilot
andcommitted
Fix YAML: indent heredoc Python code to block-scalar level
Python heredoc lines at column 0 were parsed by YAML as content outside the block scalar. Indent all heredoc lines by 10 spaces (the run: block indent level) so YAML includes them; YAML then strips the leading 10 spaces before passing to bash. Also switch from shell variable substitution inside heredoc to os.environ so the heredoc can use a quoted delimiter ('PYEOF'). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 96dbfad commit 1e07dd1

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

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

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -97,28 +97,31 @@ jobs:
9797
run: |
9898
WEEK_END=$(date -u '+%d %b %Y')
9999
100-
# Build the JSON payload with Python to avoid shell quoting issues
101-
python3 - << PYEOF
102-
import json, os
103-
activity = open('/tmp/activity.md').read()
104-
week_end = "$WEEK_END"
105-
model = "$MODEL"
106-
prompt = (
107-
"You are a technical writer for an open-source verification tools project.\n\n"
108-
f"Below is raw weekly activity (commits, PRs, issues) from the fvutils GitHub org "
109-
f"for the week ending {week_end}.\n\n"
110-
+ activity +
111-
"\n\nWrite a concise weekly news item suitable for the project website. "
112-
"Include: a short overall summary paragraph, then a per-repo highlights section "
113-
"using bullet points, and a brief \"What's next\" closing line. "
114-
"Be factual, avoid hype, use past tense for completed work."
115-
)
116-
payload = {"model": model, "messages": [{"role": "user", "content": prompt}],
117-
"max_tokens": 600, "temperature": 0.4}
118-
with open('/tmp/request.json', 'w') as f:
119-
json.dump(payload, f)
120-
print("Request JSON written.")
121-
PYEOF
100+
# Build the JSON payload with Python to avoid shell quoting issues.
101+
# All heredoc lines are indented 10 spaces so YAML includes them in the
102+
# block scalar; YAML strips the 10-space prefix before passing to bash.
103+
export WEEK_END MODEL
104+
python3 - << 'PYEOF'
105+
import json, os
106+
activity = open('/tmp/activity.md').read()
107+
week_end = os.environ['WEEK_END']
108+
model = os.environ['MODEL']
109+
prompt = (
110+
"You are a technical writer for an open-source verification tools project.\n\n"
111+
f"Below is raw weekly activity (commits, PRs, issues) from the fvutils GitHub org "
112+
f"for the week ending {week_end}.\n\n"
113+
+ activity
114+
+ "\n\nWrite a concise weekly news item suitable for the project website. "
115+
"Include: a short overall summary paragraph, then a per-repo highlights section "
116+
"using bullet points, and a brief \"What's next\" closing line. "
117+
"Be factual, avoid hype, use past tense for completed work."
118+
)
119+
payload = {"model": model, "messages": [{"role": "user", "content": prompt}],
120+
"max_tokens": 600, "temperature": 0.4}
121+
with open('/tmp/request.json', 'w') as f:
122+
json.dump(payload, f)
123+
print("Request JSON written.")
124+
PYEOF
122125
123126
gh api -X POST "/models/$MODEL/chat/completions" \
124127
--input /tmp/request.json \

0 commit comments

Comments
 (0)