Skip to content

Commit f1fcf4e

Browse files
guzmonneclaude
andcommitted
fix(release): prevent infinite loop when CI workflow is not found
The release script was getting stuck in an infinite loop when no CI workflow runs were found for the current commit. This happens when: - The commit hasn't been pushed to GitHub yet - CI hasn't been triggered for the commit - CI workflow is not configured to run on the main branch Changes: - Add 90-second timeout for waiting for CI workflow to appear - Return special exit code (3) when no workflow is found after timeout - Prompt user to proceed without CI validation or cancel the release - Provide helpful context about why CI might not be found Behavior: - Waits up to 90 seconds for CI workflow to appear - If no workflow found after 90s, asks user: "Do you want to proceed with the release anyway? (y/N)" - If user confirms (y): Proceeds without CI validation - If user declines (N): Cancels release with helpful message This prevents the script from hanging indefinitely while still giving users the option to proceed if they know CI is not configured or not yet triggered for their commit. Fixes: Infinite loop when checking CI status for unpushed commits 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f361ad6 commit f1fcf4e

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

scripts/release.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ check_ci_status() {
200200
# Wait for CI workflow to complete
201201
wait_for_ci_checks() {
202202
local start_time elapsed_time
203+
local no_workflow_wait_time=90 # Wait 90 seconds for workflow to appear
203204

204205
start_time=$(date +%s)
205206
log_step "Waiting for CI checks to complete..."
@@ -221,7 +222,13 @@ wait_for_ci_checks() {
221222
else
222223
local check_result=$?
223224
if [[ $check_result -eq 2 ]]; then
224-
# Still running, wait and check again
225+
# If no workflow found and we've waited long enough, give up
226+
if [[ $elapsed_time -ge $no_workflow_wait_time ]]; then
227+
echo # New line after progress indicator
228+
log_warning "No CI workflow found after ${no_workflow_wait_time} seconds"
229+
return 3 # Special return code for "no workflow found"
230+
fi
231+
# Still waiting, check again
225232
printf "\r${BLUE}INFO:${NC} ⏳ Waiting for CI checks... (%ss elapsed)" ${elapsed_time}
226233
sleep $WORKFLOW_CHECK_INTERVAL
227234
else
@@ -245,9 +252,32 @@ ensure_ci_passes() {
245252
local check_result=$?
246253
if [[ $check_result -eq 2 ]]; then
247254
# CI is running, wait for it
248-
if wait_for_ci_checks; then
255+
local wait_result
256+
wait_for_ci_checks
257+
wait_result=$?
258+
259+
if [[ $wait_result -eq 0 ]]; then
260+
# CI passed
249261
return 0
262+
elif [[ $wait_result -eq 3 ]]; then
263+
# No workflow found after waiting
264+
log_warning "No CI workflow runs were found for the current commit"
265+
log_info "This may happen if:"
266+
log_info " • CI hasn't been triggered yet for this commit"
267+
log_info " • The commit was made directly without pushing to GitHub"
268+
log_info " • CI workflow is not configured to run on the main branch"
269+
echo
270+
read -p "Do you want to proceed with the release anyway? (y/N): " -n 1 -r
271+
echo
272+
if [[ $REPLY =~ ^[Yy]$ ]]; then
273+
log_warning "Proceeding without CI validation"
274+
return 0
275+
else
276+
log_info "Release cancelled. Push your changes and wait for CI to run."
277+
return 1
278+
fi
250279
else
280+
# CI failed or timed out
251281
log_error "CI checks did not pass"
252282
log_error "Please fix the failing checks before creating a release"
253283
return 1

0 commit comments

Comments
 (0)