|
| 1 | +# Mergify Configuration — Optimized for multi-language monorepos |
| 2 | +# Docs: https://docs.mergify.com/ |
| 3 | + |
| 4 | +pull_request_rules: |
| 5 | + # Auto-merge when all CI checks pass and PR is approved |
| 6 | + - name: Auto-merge when approved + CI green |
| 7 | + conditions: |
| 8 | + - "#review-requested=0" |
| 9 | + - "#approved-reviews-by>=1" |
| 10 | + - check-success=ci |
| 11 | + - check-success=lint |
| 12 | + - check-success=typecheck |
| 13 | + - check-success=test |
| 14 | + - -conflict |
| 15 | + - -closed |
| 16 | + actions: |
| 17 | + merge: |
| 18 | + method: squash |
| 19 | + commit_message_template: | |
| 20 | + {{ title }} (#{{ number }}) |
| 21 | + |
| 22 | + Co-authored-by: {{ author }} |
| 23 | + post_merge: |
| 24 | + action: close |
| 25 | + |
| 26 | + # Auto-merge dependabot/Renovate PRs when CI passes |
| 27 | + - name: Auto-merge dependency updates |
| 28 | + conditions: |
| 29 | + - author=dependabot[bot] | renovate[bot] |
| 30 | + - check-success=ci |
| 31 | + - -conflict |
| 32 | + - -closed |
| 33 | + actions: |
| 34 | + merge: |
| 35 | + method: squash |
| 36 | + commit_message_template: | |
| 37 | + {{ title }} (#{{ number }}) |
| 38 | + |
| 39 | + Co-authored-by: {{ author }} |
| 40 | + post_merge: |
| 41 | + action: close |
| 42 | + |
| 43 | + # Auto-merge bot PRs (CI configs, formatting) when CI passes |
| 44 | + - name: Auto-merge bot housekeeping PRs |
| 45 | + conditions: |
| 46 | + - author=trunk-io[bot] | mergify[bot] | github-actions[bot] |
| 47 | + - check-success=ci |
| 48 | + - check-success=lint |
| 49 | + - -conflict |
| 50 | + - -closed |
| 51 | + actions: |
| 52 | + merge: |
| 53 | + method: squash |
| 54 | + |
| 55 | + # Add reviewers based on changed paths |
| 56 | + - name: Request review from team |
| 57 | + conditions: |
| 58 | + - -closed |
| 59 | + - -draft |
| 60 | + actions: |
| 61 | + request_reviews: |
| 62 | + teams: |
| 63 | + - phenotype/core |
| 64 | + github_accounts: |
| 65 | + - KooshaPari |
| 66 | + |
| 67 | + # Label PRs based on changed files |
| 68 | + - name: Label Python changes |
| 69 | + conditions: |
| 70 | + - files~=\.py$ |
| 71 | + actions: |
| 72 | + label: |
| 73 | + add: |
| 74 | + - python |
| 75 | + |
| 76 | + - name: Label Rust changes |
| 77 | + conditions: |
| 78 | + - files~=\.rs$|Cargo\. |
| 79 | + actions: |
| 80 | + label: |
| 81 | + add: |
| 82 | + - rust |
| 83 | + |
| 84 | + - name: Label Go changes |
| 85 | + conditions: |
| 86 | + - files~=\.go$|go\. |
| 87 | + actions: |
| 88 | + label: |
| 89 | + add: |
| 90 | + - go |
| 91 | + |
| 92 | + - name: Label TypeScript changes |
| 93 | + conditions: |
| 94 | + - files~=\.ts$|\.tsx$|package\.json |
| 95 | + actions: |
| 96 | + label: |
| 97 | + add: |
| 98 | + - typescript |
| 99 | + |
| 100 | + # Close stale PRs after 30 days |
| 101 | + - name: Close stale PRs |
| 102 | + conditions: |
| 103 | + - -closed |
| 104 | + - -draft |
| 105 | + - age>=30d |
| 106 | + - "#review-requested=0" |
| 107 | + actions: |
| 108 | + comment: |
| 109 | + message: > |
| 110 | + This PR has been automatically closed after 30 days of inactivity. |
| 111 | + Feel free to reopen if still relevant. |
| 112 | + close: {} |
| 113 | + |
| 114 | + # Warn on large PRs |
| 115 | + - name: Warn on large PRs |
| 116 | + conditions: |
| 117 | + - -closed |
| 118 | + - -draft |
| 119 | + - "#files>20" |
| 120 | + actions: |
| 121 | + comment: |
| 122 | + message: > |
| 123 | + **Large PR Alert**: This PR touches {{ number }} files. |
| 124 | + Consider splitting into smaller PRs for easier review. |
| 125 | +
|
| 126 | + # Add ready-to-merge label when all checks pass |
| 127 | + - name: Add ready-to-merge label |
| 128 | + conditions: |
| 129 | + - -closed |
| 130 | + - -draft |
| 131 | + - check-success=ci |
| 132 | + - check-success=lint |
| 133 | + - check-success=test |
| 134 | + - "#approved-reviews-by>=1" |
| 135 | + actions: |
| 136 | + label: |
| 137 | + add: |
| 138 | + - ready-to-merge |
0 commit comments