-
Notifications
You must be signed in to change notification settings - Fork 127
feat: add commit_count predicate #1105
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: develop
Are you sure you want to change the base?
feat: add commit_count predicate #1105
Conversation
Add predicate to count total commits in a PR with comparison operators (<, >, =). Implements part of GitHub issue palantir#1062.
Generate changelog in
|
bluekeyes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Can you please also add this new predicate to the documentation in the README?
Otherwise, the main logic looks good but I had two small comments about how to construct the the result used in the details view.
| ValuePhrase: "commits", | ||
| ConditionPhrase: "meet", | ||
| ConditionsMap: make(map[string][]string), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's only one condition in this predicate, I think you can simplify it like this:
ValuePhrase: "commit counts",
ConditionPhrase: "meet the conditions",
ConditionValues: []string{pred.Total.String()},
The ConditionsMap key is useful when you have multiple conditions.
| value := fmt.Sprintf("%d", count) | ||
| cond := fmt.Sprintf("total commits %s", pred.Total.String()) | ||
|
|
||
| predicateResult.Values = []string{value} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's set this outside of the if so that it is always available
✅ Successfully generated changelog entry!Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. 📋Changelog Preview✨ Features
|
|
ok will check and update |
Add predicate to count total commits in a PR with comparison operators (<, >, =). Implements part of GitHub issue #1062.
Before this PR
After this PR
==COMMIT_MSG==
==COMMIT_MSG==
Possible downsides?