Skip to content

Commit

Permalink
Merge pull request #445 from gsmet/fix-prefix-3.10
Browse files Browse the repository at this point in the history
Fix prefixing of PR for 3.10 (and similar)
gsmet authored Apr 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 18450cd + 387f9e2 commit 77f2357
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
@@ -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()) {
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
@@ -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"));
}
}

0 comments on commit 77f2357

Please sign in to comment.