diff --git a/src/main/java/io/quarkus/bot/util/GHPullRequests.java b/src/main/java/io/quarkus/bot/util/GHPullRequests.java index 7904532..4040724 100644 --- a/src/main/java/io/quarkus/bot/util/GHPullRequests.java +++ b/src/main/java/io/quarkus/bot/util/GHPullRequests.java @@ -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()) { diff --git a/src/test/java/io/quarkus/bot/it/util/GHPullRequestsTest.java b/src/test/java/io/quarkus/bot/it/util/GHPullRequestsTest.java index 8c776af..967b365 100644 --- a/src/test/java/io/quarkus/bot/it/util/GHPullRequestsTest.java +++ b/src/test/java/io/quarkus/bot/it/util/GHPullRequestsTest.java @@ -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 @@ -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")); } }