From ca56de99a9b0511ee72ea3c2dba3fa27eb3225de Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Mon, 3 Jul 2023 22:09:44 -0600
Subject: [PATCH] add more config options for no_merges
for rust-lang/triagebot#1704
---
src/triagebot/no-merge.md | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/src/triagebot/no-merge.md b/src/triagebot/no-merge.md
index a99d741b2..977e03f13 100644
--- a/src/triagebot/no-merge.md
+++ b/src/triagebot/no-merge.md
@@ -19,6 +19,45 @@ This feature is enabled on a repository by having a `[no-merges]` table in `tria
[no-merges]
```
+There are three optional values that can be specified in the table:
+
+* `exclude_labels` --- A list of strings of label names to exclude.
+ PRs with these labels set will not be checked for merge commits.
+
+* `labels` --- A list of strings of label names to add.
+ These labels will be set on the PR when merge commits are detected.
+
+* `message` --- Override the default message posted for merge commits.
+ The message will always be followed up with "The following commits are merge commits:" and then a list of the merge commits.
+
+#### Default message
+
+> There are merge commits (commits with multiple parents) in your changes. We have a [no merge policy](https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy) so these commits will need to be removed for this pull request to be merged.
+>
+> You can start a rebase with the following commands:
+>
+> ```shell-session
+> $ # rebase
+> $ git rebase -i master
+> $ # delete any merge commits in the editor that appears
+> $ git push --force-with-lease
+> ```
+
+## Example
+
+```toml
+[no-merges]
+# PRs with the following labels will be skipped
+exclude_labels = ["rollup", "sync"]
+# Add the following labels to PRs with merge commits
+labels = ["has-merge-commits", "S-waiting-on-author"]
+# Post the following warning message as a comment on PRs with merge commits
+message = """
+This repository does not allow merge commits.
+Your PR cannot be merged until it is rebased.
+"""
+```
+
## Implementation
See [`src/handlers/no_merges.rs`](https://github.com/rust-lang/triagebot/blob/HEAD/src/handlers/no_merges.rs).