Monitor rule reference
A Watchdog rule consists of an ID, an effect, a set of conditions, and an AND/OR choice. This reference describes matching in the live commit-diff scanner.
Rule structure
Section titled “Rule structure”Use an identifiable ID, keep Effect set to Match, and add at least one specific condition.
AND requires all conditions to match the same context. OR requires at least one. Separate Match rules are independent opportunities to produce a result.
Avoid empty rules: the live scanner treats a rule with no conditions as a match. A rule containing only repository or owner conditions can produce a commit-diff result without a file-specific match.
Properties
Section titled “Properties”| Builder label | Meaning in live monitoring |
|---|---|
| Repository Name | Repository slug, such as owner/project |
| Owner | The owner portion of that slug |
| File Content | One added line from the commit diff |
| File Path | Repository-relative path for that added line |
| File Name | Final component of the path |
| Language | A lowercase label inferred from the file extension |
| File Size | Length of the added-line text, not the whole file’s byte size |
| Binary | false for the added text-line contexts evaluated by the scanner |
For language conditions, use labels such as python, javascript, typescript, go, yaml, or json. The language value is inferred from the path; it is not a full language-analysis result.
File conditions examine added lines. Deleted text and unchanged lines elsewhere in the file do not become file-content matches.
Operators
Section titled “Operators”| Operator | Live-scanner behavior |
|---|---|
| is / equal to | Case-sensitive text equality |
| not equal to | Case-sensitive text inequality |
| contains | Case-insensitive substring match |
| not contains | Case-insensitive substring exclusion |
| contains regex | Python regular-expression search; case-sensitive by default |
| greater than / less than | Numeric comparison |
| greater than or equal / less than or equal | Inclusive numeric comparison |
Use numeric operators only with numeric values. Empty values for contains, not contains, and contains regex do not match.
Monitoring regex uses Python’s regular-expression engine. Search uses RE2. A pattern accepted in one feature may behave differently or be rejected in the other.
Examples
Section titled “Examples”Watch a repository for a marker
Section titled “Watch a repository for a marker”One Match rule with AND:
| Property | Operator | Value |
|---|---|---|
| Repository Name | is | example/project |
| File Content | contains | INTERNAL_SERVICE_URL |
Match spelling variants
Section titled “Match spelling variants”One Match rule:
| Property | Operator | Value |
|---|---|---|
| File Content | contains regex | api[_-]?key |
This regex matches lowercase forms such as api_key and api-key. Add a deliberate case-insensitivity flag if you need mixed-case variants.
Exclude a directory
Section titled “Exclude a directory”Keep the effect as Match and use AND:
| Property | Operator | Value |
|---|---|---|
| File Content | contains | example.com |
| File Path | not contains | vendor/ |
Do not place the path condition in a separate Exclude rule. Exclude effects are not applied by the live scanner.
Result granularity
Section titled “Result granularity”The scanner emits at most the first matching added-line context for each rule in a processed commit diff. A result is evidence of a match, not an exhaustive list of every matching line in that commit.
Check generated or edited rules
Section titled “Check generated or edited rules”Check that every intended restriction sits inside the correct rule, the AND/OR choice matches your intent, and file-content conditions can match on a single added line. Prefer a distinctive marker over a broad word to keep results useful.