Skip to main content

Overview

Repository rules let you define automated workflows using plain markdown files. When conditions are met, Gitar automatically executes actions — no code required.

Natural Language

Write rules in plain English, not code

Git-Native

Rules live in your repo as .gitar/rules/*.md

Integrations

Connect to Jira, Linear, Slack, and more
Repository rules are available on the Pro plan (up to 5 custom rules per organization) and Enterprise plan (unlimited rules).

Quick Start

1

Create the Rules Directory

2

Add a Rule File

Create .gitar/rules/security-review.md:
3

Commit and Push

4

Open a PR

Gitar evaluates your rules on every PR. Check the dashboard comment to see which rules matched.

Rule Structure

Rules are markdown files with YAML frontmatter:

Frontmatter Fields

Triggers

Rules are evaluated when:
  • A PR is opened — Full rule evaluation on all applicable rules
  • New commits are pushed to a PR — Re-evaluates checks, may fire automations
  • CI fails on a PR — Triggers CI-related automations (e.g. retry unrelated failures)
  • PR metadata updates — Title, description, reviewers, or labels change
  • A PR is closed or merged — Enables post-merge workflows like follow-up issue creation, compliance reporting, and merge-close notifications

Supported Actions

Post comments on the PR or as inline code reviews.
Add or remove labels based on detected conditions.
Assign specific reviewers when changes are detected.
Suggest or make code modifications.

Integrations

Jira

Link PRs to Jira tickets and update issue status automatically.
See Jira Integration for setup instructions.

Linear

Link PRs to Linear issues and update their status automatically.
See Linear Integration for setup instructions.

Slack

Send notifications to Slack channels.
See Slack Integration for setup instructions.

Custom Integrations (MCP)

On the Enterprise plan you can connect your own MCP servers as custom integrations and reference them from a rule by slug, just like the built-in integrations.
See Custom Integrations for setup instructions.

Example Rules

Documentation Required

Breaking Change Review

Auto-merge Dependabot

Debugging

Use display mode commands to see how rules are being evaluated:

Best Practices

Be Specific

Narrow conditions prevent false positives. “PRs modifying src/auth/*.ts” is better than “PRs with auth changes”.

Keep Rules Focused

One rule, one purpose. Split complex logic into multiple rules.

Test with Verbose Mode

Use gitar display:verbose to debug why rules aren’t matching.

Document Edge Cases

Include examples and edge cases in the rule body.