Skip to content

Conversation

@Kamalesh-Seervi
Copy link

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?

Add predicate to count total commits in a PR with comparison operators (<, >, =).
Implements part of GitHub issue palantir#1062.
@changelog-app
Copy link

changelog-app bot commented Nov 14, 2025

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Add the commit_count predicate

Check the box to generate changelog(s)

  • Generate changelog entry

Copy link
Contributor

@bluekeyes bluekeyes left a 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.

Comment on lines +34 to +36
ValuePhrase: "commits",
ConditionPhrase: "meet",
ConditionsMap: make(map[string][]string),
Copy link
Contributor

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}
Copy link
Contributor

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

@changelog-app
Copy link

changelog-app bot commented Nov 21, 2025

Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

✨ Features

  • Add the commit_count predicate (#1105)

@Kamalesh-Seervi
Copy link
Author

ok will check and update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants