1414 runs-on : ubuntu-latest
1515 timeout-minutes : 20
1616 steps :
17+ # Step 0: Wake up the Render server (free tier sleeps after inactivity)
18+ - name : Wake up server
19+ run : |
20+ echo "Pinging server to wake it up..."
21+ for i in 1 2 3 4 5; do
22+ response=$(curl -s -o /dev/null -w "%{http_code}" --max-time 30 "${{ secrets.API_URL }}/api/v1/reviews/version" 2>/dev/null) || true
23+ if [ "$response" = "200" ]; then
24+ echo "Server is up (attempt $i)"
25+ break
26+ fi
27+ echo "Attempt $i: server not ready (status: ${response:-timeout}), waiting 15s..."
28+ sleep 15
29+ done
30+ # Final check
31+ response=$(curl -s --max-time 60 "${{ secrets.API_URL }}/api/v1/reviews/version") || true
32+ if [ -z "$response" ]; then
33+ echo "Warning: Server may not be fully awake yet, proceeding anyway"
34+ else
35+ echo "Server responded: $response"
36+ fi
37+ env :
38+ API_URL : ${{ secrets.API_URL }}
39+
1740 # Step 1: Fetch basic PR info for all repos (low memory)
1841 - name : Step 1/4 - Fetch PR info (lite mode)
1942 run : |
@@ -25,12 +48,17 @@ jobs:
2548 echo "Step 1/4: Fetching basic PR info for $repo at $(date -u '+%Y-%m-%d %H:%M:%S UTC')..."
2649 response=$(curl -s -w "\n%{http_code}" -X POST "${{ secrets.API_URL }}/api/v1/admin/manual_scraper_run?token=${{ secrets.ADMIN_TOKEN }}&repository_name=${repo}&repository_owner=${OWNER}&lite_mode=true" \
2750 -H "Content-Type: application/json" \
28- --max-time 300)
51+ --max-time 300) || true
2952 http_code=$(echo "$response" | tail -n1)
3053 body=$(echo "$response" | sed '$d')
3154 echo "Response ($repo): $body"
3255 echo "HTTP Status ($repo): $http_code"
33- if [ "$http_code" -ge 400 ]; then
56+ if [ -z "$response" ]; then
57+ echo "Error: Step 1 timed out for $repo"
58+ if [ "$repo" = "vets-api" ]; then
59+ step_failed=true
60+ fi
61+ elif [ "$http_code" -ge 400 ]; then
3462 echo "Error: Step 1 failed for $repo with status $http_code"
3563 if [ "$repo" = "vets-api" ]; then
3664 step_failed=true
@@ -59,12 +87,14 @@ jobs:
5987 echo "Step 2/4: Fetching reviews for $repo at $(date -u '+%Y-%m-%d %H:%M:%S UTC')..."
6088 response=$(curl -s -w "\n%{http_code}" -X POST "${{ secrets.API_URL }}/api/v1/admin/fetch_reviews?token=${{ secrets.ADMIN_TOKEN }}&repository_name=${repo}&repository_owner=${OWNER}" \
6189 -H "Content-Type: application/json" \
62- --max-time 540)
90+ --max-time 540) || true
6391 http_code=$(echo "$response" | tail -n1)
6492 body=$(echo "$response" | sed '$d')
6593 echo "Response ($repo): $body"
6694 echo "HTTP Status ($repo): $http_code"
67- if [ "$http_code" -ge 400 ]; then
95+ if [ -z "$response" ]; then
96+ echo "Warning: Step 2 timed out or failed for $repo (continuing anyway)"
97+ elif [ "$http_code" -ge 400 ]; then
6898 echo "Warning: Step 2 failed for $repo with status $http_code (continuing anyway)"
6999 else
70100 echo "Step 2/4 completed for $repo"
0 commit comments