Skip to content
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

feat: group commit files into batches #398

Merged
merged 3 commits into from
Aug 24, 2022
Merged

feat: group commit files into batches #398

merged 3 commits into from
Aug 24, 2022

Conversation

chingor13
Copy link
Contributor

@chingor13 chingor13 commented Aug 24, 2022

Provides a new option for filesPerCommit which defaults to 100. If there are more than this limit, code-suggester will split into groups of files and make multiple commits. For most use cases, this is a no-op. For larger monorepos, you may see multiple commits.

Fixes #397

Ran the following command:

node build/src/bin/code-suggester.js pr -r code-suggester -o googleapis -t 'testing multiple commits' -d 'testing multiple commits description' -m 'testing multiple commits body' --branch=test-branch --fork=false -f --files-per-commit=3 --git-dir=.

with a few test files in my working directory to create: #401 which has multiple commits.

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Aug 24, 2022
* @param {string} message the message of the new commit
* @returns {Promise<string>} the new commit SHA
*/
export async function createCommit(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was moved to a separate module for ease of mocking.

@chingor13 chingor13 marked this pull request as ready for review August 24, 2022 19:36
@chingor13 chingor13 requested a review from a team as a code owner August 24, 2022 19:36
@chingor13 chingor13 requested a review from a team August 24, 2022 19:36
@chingor13 chingor13 added the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 24, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 24, 2022
@chingor13 chingor13 requested a review from bcoe August 24, 2022 19:39
@@ -53,6 +56,15 @@ export function generateTreeObjects(changes: Changes): TreeObject[] {
return tree;
}

function* inGroupsOf<T>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the use of the generator.

nit: since it's only used in one place, I wonder if it's a premature abstraction, might just have gone with function *commitBatch.

@chingor13 chingor13 merged commit e3815d5 into main Aug 24, 2022
@chingor13 chingor13 deleted the multiple-commits branch August 24, 2022 21:15
gcf-merge-on-green bot pushed a commit that referenced this pull request Aug 24, 2022
🤖 I have created a release *beep* *boop*
---


## [4.1.0](v4.0.1...v4.1.0) (2022-08-24)


### Features

* group commit files into batches ([#398](#398)) ([e3815d5](e3815d5))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
2 participants