fix(release): add retry and delay for PR creation to handle Gitea API race condition

The PR creation curl immediately follows branch creation via the Contents
API, but Gitea may not have fully indexed the new branch for pull request
operations yet. This causes intermittent HTTP errors on the first run.

- Add sleep 3 before PR creation to allow Gitea to process the new branch
- Use --retry-all-errors so curl retries on HTTP 4xx/5xx (not just
  connection failures)
- Capture and display the actual HTTP error code and response body on
  failure for easier debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-23 14:12:43 +01:00
parent e3f1ba4e0a
commit d5623bdf9c
+13 -2
View File
@@ -189,7 +189,11 @@ jobs:
fi
echo "Creating new PR..."
curl -sf --retry 3 --retry-delay 2 --retry-connrefused -X POST \
echo "Waiting for branch to be ready..."
sleep 3
RESPONSE=$(curl -s --retry 3 --retry-delay 3 --retry-all-errors --retry-connrefused \
-w "\n%{http_code}" -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
--data "$(jq -n \
@@ -198,7 +202,14 @@ jobs:
--arg head "next-release" \
--arg base "${DEFAULT_BRANCH}" \
'{title: $title, body: $body, head: $head, base: $base}')" \
"${API_URL}/pulls"
"${API_URL}/pulls")
HTTP_CODE=$(echo "${RESPONSE}" | tail -1)
BODY=$(echo "${RESPONSE}" | sed '$d')
if [ "${HTTP_CODE}" -ge 400 ]; then
echo "Error creating PR (HTTP ${HTTP_CODE}): ${BODY}"
exit 1
fi
echo "PR created successfully"
create-release:
name: Create Release