Skip to content

Commit 29b34b0

Browse files
committed
fix: indent Python heredoc content to satisfy YAML block scalar rules
Python script lines at column 0 inside a run: | block scalar caused the YAML parser to treat them as ending the block, making the entire workflow file unparseable — so the action never ran at all. YAML block scalars require every content line to be indented at least as deep as the block's own indentation (10 spaces here). GitHub Actions strips that minimum indentation before passing the script to bash, so the heredoc writes the Python file with correct zero-based indentation. https://claude.ai/code/session_01Lg4VQQXs3q3WW4aMoe3Xci
1 parent 9442c9b commit 29b34b0

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

.github/workflows/screenshot.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,17 @@ jobs:
235235
# Write Python helper with single-quoted heredoc (no shell substitution),
236236
# then pass variables as argv so there are no quoting/expansion issues.
237237
cat > /tmp/make_body.py << 'PYEOF'
238-
import json, base64, sys
239-
img_path, commit_msg, existing_sha = sys.argv[1], sys.argv[2], sys.argv[3]
240-
with open(img_path, "rb") as f:
241-
content = base64.b64encode(f.read()).decode()
242-
body = {"message": commit_msg, "content": content, "branch": "screenshots"}
243-
if existing_sha:
244-
body["sha"] = existing_sha
245-
with open("/tmp/upload-body.json", "w") as f:
246-
json.dump(body, f)
247-
print(f"Upload body: {len(content)} base64 chars")
248-
PYEOF
238+
import json, base64, sys
239+
img_path, commit_msg, existing_sha = sys.argv[1], sys.argv[2], sys.argv[3]
240+
with open(img_path, "rb") as f:
241+
content = base64.b64encode(f.read()).decode()
242+
body = {"message": commit_msg, "content": content, "branch": "screenshots"}
243+
if existing_sha:
244+
body["sha"] = existing_sha
245+
with open("/tmp/upload-body.json", "w") as f:
246+
json.dump(body, f)
247+
print(f"Upload body: {len(content)} base64 chars")
248+
PYEOF
249249
python3 /tmp/make_body.py "/tmp/mc-screenshot.png" "$COMMIT_MSG" "$EXISTING_SHA" \
250250
|| { echo "WARNING: failed to build upload body"; exit 0; }
251251

0 commit comments

Comments
 (0)