refactor(internal/librarianops/generate): move github functions to its own file#4689
refactor(internal/librarianops/generate): move github functions to its own file#4689miguelvelezsa wants to merge 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request is a good refactoring that moves GitHub-related utility functions into their own file, internal/librarianops/github_utils.go, improving separation of concerns. The addition of tests for these new utilities is also a positive change. However, I've identified a few issues. There's a critical issue with the new branch name generation logic that could cause failures if the tool is run multiple times a day. I've also noted some areas for improvement regarding redundant code, a minor style guide violation, and a bug in the new tests.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: miguel <miguelvelezsa@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4689 +/- ##
==========================================
+ Coverage 79.10% 79.15% +0.04%
==========================================
Files 111 112 +1
Lines 9420 9436 +16
==========================================
+ Hits 7452 7469 +17
Misses 1453 1453
+ Partials 515 514 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
hey @miguelvelezsa, thanks for the PR. I’ve taken a look and would prefer to keep these functions in generate.go for the time being. As we previously discussed, I’d also like to avoid introducing mocks at this stage to keep the testing structure lean. Let's hold off on this refactor for now. |
| @@ -0,0 +1,76 @@ | |||
| // Copyright 2026 Google LLC | |||
There was a problem hiding this comment.
Avoid names like utils: https://github.com/googleapis/librarian/blob/main/doc/howwewritego.md#package-names
Extracting github functions from generate and put them in its own file since upgrade command also needs them.
Also created function uploadToGithub, this functions make easier all the steps needed to upload changes to github. This function will be used in upgrade and generate, the changes for it will be in follow up PR.
For #3911.
Note: coverage complaint is related to generate tests, not to the new file.