Skip to content

Commit

Permalink
720: Incorrect usage instructions for label command
Browse files Browse the repository at this point in the history
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Sep 24, 2020
1 parent 5135120 commit 978cf2d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
Expand Up @@ -73,33 +73,39 @@ private void updateLabelMessage(List<Comment> comments, List<String> newLabels)
if (newLabels.isEmpty()) {
message.append("To determine the appropriate audience for reviewing this pull request, one or more ");
message.append("labels corresponding to different subsystems will normally be applied automatically. ");
message.append("However, no automatic labelling rule matches the changes in this pull request.\n\n");
message.append("In order to have an RFR email automatically sent to the correct mailing list, you will ");
message.append("need to add one or more labels manually using the `/label add \"label\"` command. ");
message.append("The following labels are valid: ");
var labels = bot.labelConfiguration().allowed().stream()
.sorted()
.map(label -> "`" + label + "`")
.collect(Collectors.joining(" "));
message.append(labels);
message.append(".");
message.append("However, no automatic labelling rule matches the changes in this pull request. ");
message.append("In order to have an \"RFR\" email sent to the correct mailing list, you will ");
message.append("need to add one or more applicable labels manually using the ");
message.append("[/label](https://wiki.openjdk.java.net/display/SKARA/Pull+Request+Commands#PullRequestCommands-/label)");
message.append(" pull request command.\n\n");
message.append("<details>\n");
message.append("<summary>Applicable Labels</summary>\n");
message.append("<br>\n");
message.append("\n");
bot.labelConfiguration().allowed()
.stream()
.sorted()
.forEach(label -> message.append("- `" + label + "`\n"));
message.append("\n");
message.append("</details>");
} else {
message.append("The following label");
if (newLabels.size() > 1) {
message.append("s");
}
message.append(" will be automatically applied to this pull request: ");
var labels = newLabels.stream()
.sorted()
.map(label -> "`" + label + "`")
.collect(Collectors.joining(" "));
message.append(labels);
message.append(".\n\nWhen this pull request is ready to be reviewed, an RFR email will be sent to the ");
message.append(" will be automatically applied to this pull request:\n\n");
newLabels.stream()
.sorted()
.forEach(label -> message.append("- `" + label + "`\n"));
message.append("\n");
message.append("When this pull request is ready to be reviewed, an \"RFR\" email will be sent to the ");
message.append("corresponding mailing list");
if (newLabels.size() > 1) {
message.append("s");
}
message.append(". If you would like to change these labels, use the `/label (add|remove) \"label\"` command.");
message.append(". If you would like to change these labels, use the ");
message.append("[/label](https://wiki.openjdk.java.net/display/SKARA/Pull+Request+Commands#PullRequestCommands-/label)");
message.append(" pull request command.");
}

message.append("\n");
Expand Down
Expand Up @@ -71,7 +71,11 @@ void simple(TestInfo testInfo) throws IOException {
TestBotRunner.runPeriodicItems(labelBot);
assertEquals(Set.of("rfr"), new HashSet<>(pr.labels()));
assertLastCommentContains(pr, "However, no automatic labelling rule matches the changes in this pull request.");
assertLastCommentContains(pr, "The following labels are valid: `test1` `test2`");
assertLastCommentContains(pr, "<details>");
assertLastCommentContains(pr, "<summary>Applicable Labels</summary>");
assertLastCommentContains(pr, "- `test1`");
assertLastCommentContains(pr, "- `test2`");
assertLastCommentContains(pr, "</details>");

var fileA = localRepoFolder.resolve("a.txt");
Files.writeString(fileA, "Hello");
Expand Down

1 comment on commit 978cf2d

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 978cf2d Sep 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.