Skip to content

Commit 06cd573

Browse files
talissoncostaclaude
andcommitted
ci: Merge deployment status API calls into one
The state and environment_url were fetched in 2 separate calls to the same endpoint. Now parsed from a single response — halves the API calls per poll iteration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e507f16 commit 06cd573

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/frontend-pull-request.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ jobs:
6363
DEPLOY_ID=$(gh api "repos/$REPO/deployments?sha=$SHA&environment=$(printf '%s' "$ENV_NAME" | jq -sRr @uri)&per_page=1" --jq '.[0].id // empty')
6464
6565
if [ -n "$DEPLOY_ID" ]; then
66-
STATE=$(gh api "repos/$REPO/deployments/$DEPLOY_ID/statuses?per_page=1" --jq '.[0].state // empty')
66+
RESULT=$(gh api "repos/$REPO/deployments/$DEPLOY_ID/statuses?per_page=1" --jq '.[0] | "\(.state // "") \(.environment_url // "")"')
67+
STATE=$(echo "$RESULT" | cut -d' ' -f1)
6768
if [ "$STATE" = "success" ]; then
68-
URL=$(gh api "repos/$REPO/deployments/$DEPLOY_ID/statuses?per_page=1" --jq '.[0].environment_url')
69+
URL=$(echo "$RESULT" | cut -d' ' -f2-)
6970
echo "✅ '$ENV_NAME' deployed at: $URL"
7071
break
7172
elif [ "$STATE" = "failure" ] || [ "$STATE" = "error" ]; then

0 commit comments

Comments
 (0)