@@ -195,24 +195,23 @@ runs:
195
195
--connect-timeout 10 \
196
196
"$STATUS_URL")
197
197
198
- # Handle polling response
199
198
curl_exit_code=$?
200
199
http_code=${response: -3}
201
200
202
201
# Handle curl errors
203
202
if [ $curl_exit_code -ne 0 ]; then
204
203
echo "⚠️ Warning: Status check failed with curl exit code $curl_exit_code"
205
- echo "🔄 Retrying in 60 seconds..."
206
- sleep 60
204
+ echo "🔄 Retrying in 30 seconds..."
205
+ sleep 30
207
206
continue
208
207
fi
209
208
210
209
if [ "$http_code" != "200" ]; then
211
210
echo "⚠️ Warning: Status check failed with HTTP code $http_code"
212
211
echo "📄 Response content:"
213
212
cat "$TEMP_FILE"
214
- echo "🔄 Retrying in 60 seconds..."
215
- sleep 60
213
+ echo "🔄 Retrying in 30 seconds..."
214
+ sleep 30
216
215
continue
217
216
fi
218
217
@@ -221,8 +220,8 @@ runs:
221
220
echo "⚠️ Warning: Invalid JSON response"
222
221
echo "📄 Response content:"
223
222
cat "$TEMP_FILE"
224
- echo "� Retrying in 60 seconds..."
225
- sleep 60
223
+ echo "🔄 Retrying in 30 seconds..."
224
+ sleep 30
226
225
continue
227
226
fi
228
227
@@ -234,20 +233,30 @@ runs:
234
233
if [ "$STATUS" = "COMPLETED" ]; then
235
234
echo "✅ Job completed successfully!"
236
235
237
- # Check if result field exists
238
- if jq -e '.result' "$TEMP_FILE" > /dev/null; then
239
- echo "� Result found, extracting files ..."
236
+ # Check if result field exists and contains files
237
+ if jq -e '.result.files ' "$TEMP_FILE" > /dev/null; then
238
+ echo "📦 Result with files found, preparing output ..."
240
239
241
- # Extract the result field and save as the final response
240
+ # Extract just the result object into a new file
242
241
jq '.result' "$TEMP_FILE" > "${TEMP_FILE}_result"
243
- mv "${TEMP_FILE}_result" "$TEMP_FILE"
244
242
245
- echo "response_file=$TEMP_FILE" >> $GITHUB_OUTPUT
246
- break
243
+ # Verify the extracted result
244
+ if jq -e '.files' "${TEMP_FILE}_result" > /dev/null; then
245
+ echo "✅ Files extracted successfully"
246
+ mv "${TEMP_FILE}_result" "$TEMP_FILE"
247
+ echo "response_file=$TEMP_FILE" >> $GITHUB_OUTPUT
248
+ exit 0 # Successfully extracted files, exit with success
249
+ else
250
+ echo "❌ Error: Extracted result is missing files structure"
251
+ echo "📄 Extracted content:"
252
+ cat "${TEMP_FILE}_result"
253
+ rm -f "${TEMP_FILE}_result" "$TEMP_FILE"
254
+ exit 1
255
+ fi
247
256
else
248
- echo "❌ Error: Job completed but no result field found"
249
- echo "📄 Response content :"
250
- cat "$TEMP_FILE"
257
+ echo "❌ Error: Job completed but no result.files found in response "
258
+ echo "📄 Response structure :"
259
+ jq '.' "$TEMP_FILE"
251
260
rm -f "$TEMP_FILE"
252
261
exit 1
253
262
fi
@@ -267,15 +276,15 @@ runs:
267
276
echo "🕐 Last updated: $UPDATED_AT"
268
277
fi
269
278
270
- echo "💤 Waiting 60 seconds before next check..."
271
- sleep 60
279
+ echo "💤 Waiting 15 seconds before next check..."
280
+ sleep 15
272
281
fi
273
282
done
274
283
275
- # If we reach here, we've exceeded max polls
284
+ # Only reach here if we've exceeded max polls without completion
276
285
echo "❌ Error: Job polling timed out after $MAX_POLLS attempts"
277
286
echo "🏗️ The repository analysis is taking longer than expected."
278
- echo "� This might be due to:"
287
+ echo "📊 This might be due to:"
279
288
echo " • Very large repository size (>10k files)"
280
289
echo " • Complex codebase requiring extensive analysis"
281
290
echo " • Server load or processing delays"
0 commit comments