|
| 1 | +# Auto-approval rules |
| 2 | + |
| 3 | +This file defines rules Gitar should use to auto-approve merge requests in this |
| 4 | +repository. Each rule has a natural-language `When` condition and an `Action`. |
| 5 | + |
| 6 | +Dependency updates are out of scope here. Renovate labels its non-major dev |
| 7 | +dependency MRs `automerge`, and a bot approves and merges them. Updates to |
| 8 | +runtime dependencies change what users of the published package install, so |
| 9 | +they always wait for a human. Do not auto-approve dependency update MRs. |
| 10 | + |
| 11 | +## Rule: Documentation-only changes |
| 12 | + |
| 13 | +**When:** Every changed file in the merge request is a Markdown file (`.md`) or |
| 14 | +`catalog-info.yaml`, and the merge request does not touch source code, CI |
| 15 | +configuration, or dependency manifests. |
| 16 | + |
| 17 | +**Action:** Approve the merge request automatically and add the label |
| 18 | +`auto-approved`. |
| 19 | + |
| 20 | +## Rule: Test-only changes |
| 21 | + |
| 22 | +**When:** Every changed file in the merge request is under `deepl-java/src/test/`, and |
| 23 | +the merge request does not modify library source code, CI configuration, or |
| 24 | +dependency manifests. |
| 25 | + |
| 26 | +**Action:** Approve the merge request automatically and add the label |
| 27 | +`auto-approved`. |
| 28 | + |
| 29 | +## Rule: Re-approve after rebase |
| 30 | + |
| 31 | +**When:** The merge request was previously approved by at least one human |
| 32 | +reviewer, and the approval was reset solely because the author rebased or |
| 33 | +force-pushed. The substantive diff relative to the target branch is identical |
| 34 | +to the version that received the original approval, and no new commits with new |
| 35 | +logic or content were added since that approval. |
| 36 | + |
| 37 | +**Action:** Approve the merge request automatically and add the label |
| 38 | +`auto-approved`. |
| 39 | + |
| 40 | +## Rule: Safe, backwards-compatible change |
| 41 | + |
| 42 | +**When:** All of the following hold for the merge request: |
| 43 | + |
| 44 | +- **CI is green.** The pipeline for the latest commit has completed |
| 45 | + successfully, with no failing, running, or pending required jobs. |
| 46 | +- **Tests cover the change if needed.** New or changed library behavior has a |
| 47 | + matching case under `deepl-java/src/test/`. Changes that genuinely need no tests, such |
| 48 | + as comments or log text, may omit them. |
| 49 | +- **The diff matches the MR description.** The code changes do exactly what the |
| 50 | + title and description say, with no unexplained or unrelated changes bundled |
| 51 | + in. |
| 52 | +- **The public API stays backwards compatible.** Adding new capability is fine: |
| 53 | + new methods, new classes, new optional parameters, new options, or new |
| 54 | + response fields passed through to callers. What is not allowed is breaking |
| 55 | + what already exists. Do not auto-approve a removed or renamed public class, |
| 56 | + method, parameter, constant, or error type, a behavior change in an existing |
| 57 | + method, a raised minimum supported Java version, or a change to the runtime dependencies in |
| 58 | + `deepl-java/build.gradle.kts`. This library is published to Maven Central as `com.deepl.api:deepl-java`, so a break here |
| 59 | + lands in user code with the next release. |
| 60 | + |
| 61 | +**Action:** Approve the merge request automatically and add the label |
| 62 | +`auto-approved`. |
| 63 | + |
| 64 | +> Apply this rule strictly: only approve when the merge request **clearly and |
| 65 | +> unambiguously** satisfies every condition above. If any condition is |
| 66 | +> uncertain, leave the merge request for human review. |
| 67 | +
|
| 68 | +## Rule: Everything else |
| 69 | + |
| 70 | +**When:** The merge request does not clearly satisfy one of the rules above. |
| 71 | +This includes CI configuration (`.gitlab-ci.yml`, `.github/`), |
| 72 | +`.auto-approve.yaml`, `.gitar/**`, `renovate.json5`, and a release cut, which |
| 73 | +updates the version numbers in the files that `.bumpversion.toml` lists and |
| 74 | +moves the `[Unreleased]` section of `CHANGELOG.md`. |
| 75 | + |
| 76 | +**Action:** Do not auto-approve. Leave the merge request for human review. |
0 commit comments