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/*.mdIntegrations
Connect to Jira, Linear, Slack, and more
Quick Start
Rule Structure
Rules are markdown files with YAML frontmatter:Frontmatter Fields
| Field | Required | Description |
|---|---|---|
title | Yes | Rule name displayed in the dashboard |
description | Yes | Brief summary shown in compact mode |
when | Yes | Natural language condition that triggers the rule |
actions | Yes | What Gitar does when the condition is met |
integrations | No | External tools the rule needs (jira, linear, slack) |
Triggers
Rules are evaluated when:- A PR/MR is opened — Full rule evaluation on all applicable rules
- New commits are pushed to a PR/MR — Re-evaluates checks, may fire automations
- CI fails on a PR/MR — Triggers CI-related automations (e.g. retry unrelated failures)
- PR/MR metadata updates — Title, description, reviewers, or labels change
- A PR/MR is closed or merged — Enables post-merge workflows like follow-up issue creation, compliance reporting, and merge-close notifications
Supported Actions
Post Comments
Post Comments
Post comments on the PR or as inline code reviews.
Apply Labels
Apply Labels
Add or remove labels based on detected conditions.
Assign Reviewers
Assign Reviewers
Assign specific reviewers when changes are detected.
Suggest Code Changes
Suggest Code Changes
Suggest or make code modifications.
Integrations
Jira
Link PRs to Jira tickets and update issue status automatically.Linear
Link PRs to Linear issues and update their status automatically.Slack
Send notifications to Slack channels.Example Rules
Documentation Required
Breaking Change Review
Auto-merge Dependabot
Debugging
Use display mode commands to see how rules are being evaluated:| Command | Description |
|---|---|
gitar display:verbose | Show all rules with explanations for why each matched or didn’t |
gitar display:compact | Show only relevant rules (default) |
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.