Skip to content

Commit 9cd8d02

Browse files
JOYclaude
andcommitted
fix(ci): use REST POST /pulls (gh pr create's GraphQL lag exceeded 30s retry budget)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent afcf178 commit 9cd8d02

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/sync-upstream.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,17 +254,22 @@ jobs:
254254
[Upstream release notes](https://github.com/blockscout/blockscout/releases/tag/$TAG)
255255
EOF
256256
)"
257+
# Use REST API directly — gh pr create uses GraphQL which has a
258+
# longer replication lag against new branches (>30s observed).
259+
PR_TITLE="Sync upstream $TAG (merge conflicts)"
257260
for attempt in 1 2 3 4 5 6; do
258-
if gh pr create \
259-
--title "Sync upstream $TAG (merge conflicts)" \
260-
--body "$PR_BODY" \
261-
--head "$BRANCH" \
262-
--base main; then
261+
HTTP_CODE=$(jq -n --arg t "$PR_TITLE" --arg b "$PR_BODY" --arg h "$BRANCH" \
262+
'{title:$t, body:$b, head:$h, base:"main"}' | \
263+
gh api -X POST "repos/${GITHUB_REPOSITORY}/pulls" \
264+
--input - \
265+
--silent 2>&1)
266+
if [ $? -eq 0 ]; then
263267
echo "PR created successfully on attempt $attempt"
264268
exit 0
265269
fi
266-
echo "gh pr create failed (attempt $attempt), retrying in 5s..."
270+
echo "PR creation failed (attempt $attempt): $HTTP_CODE"
271+
echo "Retrying in 5s..."
267272
sleep 5
268273
done
269-
echo "::error::gh pr create failed after 6 attempts"
274+
echo "::error::PR creation failed after 6 attempts"
270275
exit 1

0 commit comments

Comments
 (0)