Add API response logging to open-pr step for debugging
All checks were successful
CI / Lint (ruff) (push) Successful in 10s
CI / Test (pytest) (3.11) (push) Successful in 19s
CI / Test (pytest) (3.12) (push) Successful in 18s
CI / SAST (bandit) (push) Successful in 11s
CI / Dependency audit (pip-audit) (push) Successful in 18s
CI / Open PR to main (push) Successful in 3s

This commit is contained in:
2026-04-04 17:47:43 -03:00
parent ed749a8c31
commit fc7fca998f

View File

@@ -61,15 +61,19 @@ jobs:
steps: steps:
- name: Open PR via Gitea API - name: Open PR via Gitea API
run: | run: |
EXISTING=$(curl -s \ echo "--- Checking for existing open PRs ---"
LIST_RESPONSE=$(curl -s \
-H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \ -H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \
"https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls?state=open&head=dev&base=main" \ "https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls?state=open&head=anti:dev&base=main&limit=5")
| python3 -c "import sys, json; print(len(json.load(sys.stdin)))") echo "$LIST_RESPONSE"
EXISTING=$(echo "$LIST_RESPONSE" | python3 -c "import sys, json; print(len(json.load(sys.stdin)))")
echo "Open PRs found: $EXISTING"
if [ "$EXISTING" -gt "0" ]; then if [ "$EXISTING" -gt "0" ]; then
echo "PR already open, skipping." echo "PR already open, skipping."
exit 0 exit 0
fi fi
curl -s -X POST \ echo "--- Creating PR ---"
CREATE_RESPONSE=$(curl -s -X POST \
-H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \ -H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{
@@ -78,4 +82,5 @@ jobs:
"base": "main", "base": "main",
"body": "All CI and security checks passed. Review and merge when ready." "body": "All CI and security checks passed. Review and merge when ready."
}' \ }' \
"https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls" "https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls")
echo "$CREATE_RESPONSE"