Compare commits

1 Commits

Author SHA1 Message Date
a778aaa57c modifying create pr to make the payload in python
All checks were successful
CI / black (pull_request) Successful in 1m18s
CI / ruff (pull_request) Successful in 1m17s
CI / mypy (pull_request) Successful in 1m25s
CI / pytest (pull_request) Successful in 1m20s
2026-03-26 16:10:59 -07:00

View File

@@ -12,20 +12,31 @@ git add pyproject.toml poetry.lock
git commit -m "chore: update dependencies $(date +%Y-%m-%d)"
git push "https://oauth2:${CI_TOKEN}@${CI_SERVER_URL#https://}/${REPO}.git" "$BRANCH"
DESCRIPTION=$(cat "$SUMMARY_FILE")
# build the entire JSON payload in Python to avoid shell escaping issues
PAYLOAD=$(python3 - <<EOF
import json, sys
with open("${SUMMARY_FILE}") as f:
description = f.read()
payload = {
"head": "${BRANCH}",
"base": "main",
"title": "chore: dependency updates $(date +%Y-%m-%d)",
"body": description,
"assignees": [${ASSIGNEE_ID}],
}
print(json.dumps(payload))
EOF
)
HTTP_RESPONSE=$(curl --silent --show-error \
--write-out "HTTPSTATUS:%{http_code}" \
--request POST \
--header "Authorization: token ${CI_TOKEN}" \
--header "Content-Type: application/json" \
--data "{
\"head\": \"${BRANCH}\",
\"base\": \"main\",
\"title\": \"chore: dependency updates $(date +%Y-%m-%d)\",
\"body\": $(echo "$DESCRIPTION" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))'),
\"assignee\": "${CI_ASSIGNEE_ID}"
}" \
--data "$PAYLOAD" \
"${CI_SERVER_URL}/api/v1/repos/${REPO}/pulls")
HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed -e 's/HTTPSTATUS:.*//g')