policy-bot icon indicating copy to clipboard operation
policy-bot copied to clipboard

Adding new features built-in predicates (changed_files_count, commit_count, commit_messages)

Open Kamalesh-Seervi opened this issue 6 months ago • 3 comments

Sample policy snippet Drop something like this into your policy YAML (for example under a rule’s requires → predicates):

predicates:
  changed_files_count:
    total: "< 20"
    added: "<= 5"
    files:
      include:
        - "^src/.*"
      exclude:
        - "^docs/.*"
  commit_count:
    total: "<= 10"
  commit_messages:
    mode: all
    scope: subject
    matches:
      - "^JIRA-[0-9]+:"
    not_matches:
      - "(WIP|fixup)"

Kamalesh-Seervi avatar Sep 30 '25 21:09 Kamalesh-Seervi

Shall I work in this too

Kamalesh-Seervi avatar Sep 30 '25 21:09 Kamalesh-Seervi

PRs for new predicates are generally welcome and these seem like reasonable things to add. Can you share an example of a policy you are trying to implement where these would help?

If you'd like to work on this, please submit a separate PR for each new predicate to make it easier to review and discuss.

bluekeyes avatar Oct 06 '25 21:10 bluekeyes

@bluekeyes I have created the pr plz check this added testing test cases and attached test ss.

I need this feature for my product

Kamalesh-Seervi avatar Nov 13 '25 18:11 Kamalesh-Seervi