PRs as links in the changelog,

Fixed some changelog typos,
Added few missing PR references in the Changelog
This commit is contained in:
Jindra Petřík
2023-10-01 18:21:38 +02:00
parent bcb27b6955
commit 0c8ecfe8d4
3 changed files with 70 additions and 28 deletions
+18 -2
View File
@@ -32,7 +32,9 @@ import java.util.regex.Pattern;
public class ChangelogUpdater {
private static final String GITHUB_ADDRESS = "https://github.com/jindrapetrik/jpexs-decompiler/";
private static final String ISSUE_TRACKER_ADDRESS = "https://www.free-decompiler.com/flash/issues/";
private static final String ISSUE_TRACKER_ADDRESS = "https://www.free-decompiler.com/flash/issues/";
private static final String PR_URL_PREFIX = GITHUB_ADDRESS + "pull/";
private static final String CHANGELOG_FILENAME = "CHANGELOG.md";
@@ -41,8 +43,11 @@ public class ChangelogUpdater {
changeLog = changeLog.replaceAll("\\[[^\\]]+\\]: [^\\r\\n]+\\r\\n", "");
changeLog = changeLog.replaceAll("\\[#([0-9]+)\\]", "#$1");
changeLog = changeLog.replaceAll("#([0-9]+)", "[#$1]");
changeLog = changeLog.replaceAll("\\[PR([0-9]+)\\]", "PR$1");
changeLog = changeLog.replaceAll("PR([0-9]+)", "[PR$1]");
Pattern issuePattern = Pattern.compile("\\[#([0-9]+)\\]");
@@ -52,6 +57,14 @@ public class ChangelogUpdater {
issues.add(Integer.parseInt(issueMatcher.group(1)));
}
Pattern prPattern = Pattern.compile("PR([0-9]+)");
Matcher prMatcher = prPattern.matcher(changeLog);
Set<Integer> prs = new LinkedHashSet<>();
while (prMatcher.find()) {
prs.add(Integer.parseInt(prMatcher.group(1)));
}
Pattern headerPattern = Pattern.compile("## \\[([^\\]]+)\\]");
Matcher headerMatcher = headerPattern.matcher(changeLog);
@@ -90,6 +103,9 @@ public class ChangelogUpdater {
for (int issue : issues) {
changeLog += "[#" + issue + "]: " + ISSUE_TRACKER_ADDRESS + issue + "\r\n";
}
for (int pr : prs) {
changeLog += "[PR" + pr + "]: " + PR_URL_PREFIX + pr + "\r\n";
}
Helper.writeFile(CHANGELOG_FILENAME, changeLog.getBytes("UTF-8"));
}
+3 -1
View File
@@ -112,6 +112,8 @@ public class MetainfoUpdater {
}
private static String filterLiText(String li) {
return li.replaceAll("\\[(#[0-9]+)\\]", "$1");
li = li.replaceAll("\\[(#[0-9]+)\\]", "$1");
li = li.replaceAll("\\[(PR[0-9]+)\\]", "$1");
return li;
}
}