-
Notifications
You must be signed in to change notification settings - Fork 38
Bugfix/handle errors more gracefully #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Bugfix/handle errors more gracefully #44
Conversation
WalkthroughAdds error tracking, consolidated result output, signal traps, refined deletion recording, enhanced fetch with retry, improved branch discovery and SHA retrieval, and differentiated error codes and logging within the delete-old-branches script. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User/CI
participant S as delete-old-branches
participant G as git remote (origin)
participant O as GITHUB_OUTPUT
Note over S: Setup
S->>S: Init deleted_branches[], error_branches[]
S->>S: set trap INT/TERM → output_results + exit 130
Note over S,G: Fetch with retry
S->>G: git fetch --prune --unshallow
alt fetch fails (shallow/other)
S->>G: git fetch --prune
opt complete clone
S->>S: log fetch error and continue
end
end
Note over S,G: Discover branches
loop for each candidate branch
S->>G: git log origin/<branch> (existence/access)
alt missing/inaccessible
S->>S: error_branches += missing_or_inaccessible
else recent commits?
alt no recent commits
S->>G: resolve SHA via origin/<branch>
alt no_sha/empty_sha
S->>S: error_branches += no_sha | empty_sha
else got SHA
S->>S: proceed to deletion checks
end
else has commits
S->>S: proceed to deletion checks
end
end
Note over S: Skip rules
S->>S: Skip if default/protected/open PR
alt eligible to delete
S->>G: delete branch (or dry-run)
alt ok
S->>S: deleted_branches += branch
else failure
S->>S: error_branches += delete_failed
S->>S: dump debug.log
end
end
end
Note over S,O: Finalize
S->>O: output_results(deleted_branches, error_branches)
S-->>U: Print summary to console and exit
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Attempting to handle errors more gracefully during this action.
Example error that can cause the entire script to exit suddenly, and not continue:
Summary by CodeRabbit
New Features
Improvements
Bug Fixes