feat(go-predicate): customize #1104
Open
+1,295
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Before this PR
Policy-bot lacked predicates to enforce policies based on:
This made it difficult to implement common policies like:
Referenced issue: #1062
After this PR
Adds three new built-in predicates to enable more granular PR policies:
1.
changed_files_count- Count changed files with advanced filtering2.
commit_count- Count total commits in a PR3.
commit_messages- Match commit message patternsImplementation Details:
MessageHeadlineandMessageBodyfields toCommitstruct forcommit_messagespredicate./godelw verify✅Example Use Cases:
==COMMIT_MSG==
feat: Add changed_files_count, commit_count, and commit_messages predicates
Implements three new predicates requested in issue #1062:
Also adds MessageHeadline and MessageBody fields to Commit struct to support
commit message pattern matching.
All predicates include comprehensive tests and follow existing code patterns.
==COMMIT_MSG==
Possible downsides?
Breaking Changes:
GraphQL Query Changes:
messageHeadlineandmessageBodyfields to commit queries. This increases the data fetched per commit but is necessary for thecommit_messagespredicate functionality.Performance Considerations:
changed_files_countiterates through all changed files, which should have minimal impact for typical PRs (< 1000 files).commit_messagesiterates through all commits, efficient for typical PRs (< 100 commits).API Compatibility:
Commitstruct now includes two new fields (MessageHeadline,MessageBody). This is backward compatible as Go's zero values (empty strings) are safe defaults.