Skip to content

feat: add conditional rule logic via <code>when:</code> block (issue #73, PR 1/3)#75

Draft
codesensei-tushar wants to merge 5 commits intowarestack:mainfrom
codesensei-tushar:feat/first-time-contributor-rules
Draft

feat: add conditional rule logic via <code>when:</code> block (issue #73, PR 1/3)#75
codesensei-tushar wants to merge 5 commits intowarestack:mainfrom
codesensei-tushar:feat/first-time-contributor-rules

Conversation

@codesensei-tushar
Copy link
Copy Markdown
Contributor

feat: add conditional rule logic via when: block (issue #73, PR 1/3)

Part of #73

Summary

Rules in .watchflow/rules.yaml can now declare a when: block that gates evaluation. If the predicates don't match, the rule is skipped before any validator or LLM work runs (skip reason is logged).

rules:
  - description: Require Changelog (first-time contributors only)
    event_types: [pull_request]
    parameters:
      changelog_required: true
    when:
      contributor: first_time
      files_match: "src/auth/**"

Supported Predicates (v1)

All optional. Multiple predicates combine with AND.

Predicate Example Semantics
contributor: first_time when: { contributor: first_time } Zero prior merged PRs
contributor: trusted when: { contributor: trusted } ≥1 prior merged PR
pr_count_below: N when: { pr_count_below: 3 } Fewer than N merged PRs
files_match when: { files_match: "src/auth/**" } Changed file matches glob (string or list)

Expression parser (and / or / comparisons) and extended predicates (risk.level, contributor.role, …) are deferred to PRs 2/3 and 3/3.

@trunk-io
Copy link
Copy Markdown

trunk-io bot commented Apr 17, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e71fd260-d8d3-40c9-966d-88ba5f8ddd73

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant