Consolidate sync actions in route handlers#240
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates duplicated logic in GitHub route handlers by extracting common sync, delete, and pipeline context operations into shared helper functions. The RepoConfig class is also updated to compute fullname automatically.
Changes:
- Extracted
_sync_refs,_delete_ref,_get_dest_context,_get_pr_target_ref, and_get_pr_pipeline_contextas shared helpers to eliminate duplicated code across push and pull request event handlers. - Simplified
sync_prsignature by removing thesrc_repo_privateparameter (now derived from thepull_requestdict directly). - Changed
RepoConfig.fullnameto be auto-computed fromdest_organddest_nameinstead of being passed as a separate parameter.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/hubcast/web/github/routes.py |
Route handlers refactored to use new helper functions, removing significant code duplication |
src/hubcast/repos/config.py |
RepoConfig.fullname now auto-computed from dest_org/dest_name |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hubcast config settings for repos should only be fetched from the default branch of the base repository. Previously, we were getting the config from the head repo, which would lead to potential confusion for users submitting PRs via forks. This ensures that there is one source of settings for each repository. I pulled this out of llnl#240 to make for a faster review.
Hubcast config settings for repos should only be fetched from the default branch of the base repository. Previously, we were getting the config from the head repo, which would lead to potential confusion for users submitting PRs via forks. This ensures that there is one source of settings for each repository. I pulled this out of #240 to make for a faster review.
9e8e2e5 to
c9ac693
Compare
c9ac693 to
a26cc77
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dc3e0ce to
9f5ff47
Compare
e3e100d to
525b576
Compare
There was a lot of duplicated code/logic in the route handlers, especially for the sync/delete ref actions. I was a bit aggressive with the consolidation, so let me know if you'd like to keep something expanded. address review add guard when a ref to be deleted does not exist unconsolidate _get_pr_pipeline_context and _get_dest_context style
525b576 to
b71c69c
Compare
There was a lot of duplicated code/logic in the route handlers, especially for the sync/delete ref actions. I was a bit aggressive with the consolidation, so let me know if you'd like to keep something expanded.