Skip to content

Commit 51ee907

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 b8f2457 commit 51ee907

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/sync-upstream.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,23 @@ jobs:
133133
[Upstream release notes](https://github.com/blockscout/frontend/releases/tag/$TAG)
134134
EOF
135135
)"
136+
# Use REST API directly — gh pr create uses GraphQL which has a
137+
# longer replication lag against new branches (>30s observed).
138+
# REST /pulls accepts the head SHA directly and works immediately.
139+
PR_TITLE="Sync upstream $TAG (merge conflicts)"
136140
for attempt in 1 2 3 4 5 6; do
137-
if gh pr create \
138-
--title "Sync upstream $TAG (merge conflicts)" \
139-
--body "$PR_BODY" \
140-
--head "$BRANCH" \
141-
--base main; then
141+
HTTP_CODE=$(jq -n --arg t "$PR_TITLE" --arg b "$PR_BODY" --arg h "$BRANCH" \
142+
'{title:$t, body:$b, head:$h, base:"main"}' | \
143+
gh api -X POST "repos/${GITHUB_REPOSITORY}/pulls" \
144+
--input - \
145+
--silent 2>&1)
146+
if [ $? -eq 0 ]; then
142147
echo "PR created successfully on attempt $attempt"
143148
exit 0
144149
fi
145-
echo "gh pr create failed (attempt $attempt), retrying in 5s..."
150+
echo "PR creation failed (attempt $attempt): $HTTP_CODE"
151+
echo "Retrying in 5s..."
146152
sleep 5
147153
done
148-
echo "::error::gh pr create failed after 6 attempts"
154+
echo "::error::PR creation failed after 6 attempts"
149155
exit 1

0 commit comments

Comments
 (0)