Skip to content

Commit

Permalink
Fix prefixing of PR for 3.10 (and similar)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Apr 26, 2024
1 parent 18450cd commit 387f9e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/io/quarkus/bot/util/GHPullRequests.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public final class GHPullRequests {

private static final Pattern CLEAN_VERSION_PATTERN = Pattern.compile("^\\[?\\(?[0-9]+\\.[0-9]+\\]?\\)?(?!\\.)[ -]*");
private static final Pattern CLEAN_VERSION_PATTERN = Pattern.compile("^\\[?\\(?[0-9]+\\.[0-9]+\\]?\\)?(?![\\.0-9])[ -]*");

public static boolean hasLabel(GHPullRequest pullRequest, String labelName) {
for (GHLabel label : pullRequest.getLabels()) {
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/io/quarkus/bot/it/util/GHPullRequestsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public void testDropVersionSuffix() {
assertThat(GHPullRequests.dropVersionSuffix("[3.9] My PR", "3.8")).isEqualTo(("My PR"));
assertThat(GHPullRequests.dropVersionSuffix("(3.9) My PR", "3.8")).isEqualTo(("My PR"));
assertThat(GHPullRequests.dropVersionSuffix("My PR [3.7]", "3.8")).isEqualTo(("My PR [3.7]"));
assertThat(GHPullRequests.dropVersionSuffix("3.10.4 Backports 1", "3.10")).isEqualTo(("3.10.4 Backports 1"));
assertThat(GHPullRequests.dropVersionSuffix("(3.10) My PR", "3.10")).isEqualTo(("My PR"));
assertThat(GHPullRequests.dropVersionSuffix("[3.10] My PR", "3.10")).isEqualTo(("My PR"));
}

@Test
Expand All @@ -34,5 +37,6 @@ public void testNormalizeTitle() {
assertThat(GHPullRequests.normalizeTitle("(3.9) My PR", "3.8")).isEqualTo(("[3.8] My PR"));
assertThat(GHPullRequests.normalizeTitle("My PR [3.7]", "3.8")).isEqualTo(("[3.8] My PR [3.7]"));
assertThat(GHPullRequests.normalizeTitle("2.10 - My PR", "2.10")).isEqualTo(("[2.10] My PR"));
assertThat(GHPullRequests.normalizeTitle("3.10.4 Backports 1", "3.10")).isEqualTo(("[3.10] 3.10.4 Backports 1"));
}
}

0 comments on commit 387f9e2

Please sign in to comment.