#2019 - Prepare changelog.

This commit is contained in:
Oliver Drotbohm
2023-07-14 09:27:08 +02:00
parent 3dfb11d6b6
commit 628c21b9c4
2 changed files with 54 additions and 45 deletions

View File

@@ -1,6 +1,15 @@
Spring HATEOAS Changelog
========================
Changes in version 2.0.5 (2023-07-14)
----------------------------------------
- #2018 - Switch to UriComponentsBuilder.fromUri(…).
- #2013 - Upgrade to Spring Framework 6.0.11.
- #2008 - Upgrade to Slf4j 2.0.7.
- #2006 - Upgrade to Reactor 2022.0.9.
- #2002 - Upgrade to Lombok 1.18.28.
- #1991 - Upgrade to Logback 1.4.8.
Changes in version 2.0.4 (2023-05-11)
----------------------------------------
- #1972 - Upgrade to Reactor 2022.0.7.

View File

@@ -38,66 +38,66 @@ import com.jayway.jsonpath.JsonPath;
*/
class ChangelogCreator {
private static final int MILESTONE_ID = 117;
private static final String URI_TEMPLATE = "https://api.github.com/repos/spring-projects/spring-hateoas/issues?milestone={id}&state=closed";
private static final int MILESTONE_ID = 119;
private static final String URI_TEMPLATE = "https://api.github.com/repos/spring-projects/spring-hateoas/issues?milestone={id}";
public static void main(String... args) {
public static void main(String... args) {
/*
* If you run into github rate limiting issues, you can always use a Github Personal Token by adding
* {@code .header(HttpHeaders.AUTHORIZATION, "token your-github-token")} to the webClient call.
*/
/*
* If you run into github rate limiting issues, you can always use a Github Personal Token by adding
* {@code .header(HttpHeaders.AUTHORIZATION, "token your-github-token")} to the webClient call.
*/
WebClient webClient = WebClient.create();
WebClient webClient = WebClient.create();
HttpEntity<String> response = webClient //
.get().uri(URI_TEMPLATE, MILESTONE_ID) //
.exchangeToMono(clientResponse -> clientResponse.toEntity(String.class)) //
.block(Duration.ofSeconds(10));
HttpEntity<String> response = webClient //
.get().uri(URI_TEMPLATE, MILESTONE_ID) //
.exchangeToMono(clientResponse -> clientResponse.toEntity(String.class)) //
.block(Duration.ofSeconds(10));
boolean keepChecking = true;
boolean printHeader = true;
boolean keepChecking = true;
boolean printHeader = true;
while (keepChecking) {
while (keepChecking) {
readPage(response.getBody(), printHeader);
printHeader = false;
readPage(response.getBody(), printHeader);
printHeader = false;
List<String> linksInHeader = response.getHeaders().get(HttpHeaders.LINK);
Links links = linksInHeader == null ? Links.NONE : Links.parse(linksInHeader.get(0));
List<String> linksInHeader = response.getHeaders().get(HttpHeaders.LINK);
Links links = linksInHeader == null ? Links.NONE : Links.parse(linksInHeader.get(0));
if (links.getLink(IanaLinkRelations.NEXT).isPresent()) {
if (links.getLink(IanaLinkRelations.NEXT).isPresent()) {
response = webClient //
.get().uri(links.getRequiredLink(IanaLinkRelations.NEXT).expand().getHref()) //
.exchangeToMono(clientResponse -> clientResponse.toEntity(String.class)) //
.block(Duration.ofSeconds(10));
response = webClient //
.get().uri(links.getRequiredLink(IanaLinkRelations.NEXT).expand().getHref()) //
.exchangeToMono(clientResponse -> clientResponse.toEntity(String.class)) //
.block(Duration.ofSeconds(10));
} else {
keepChecking = false;
}
}
}
} else {
keepChecking = false;
}
}
}
private static void readPage(String content, boolean header) {
private static void readPage(String content, boolean header) {
JsonPath titlePath = JsonPath.compile("$[*].title");
JsonPath idPath = JsonPath.compile("$[*].number");
JsonPath titlePath = JsonPath.compile("$[*].title");
JsonPath idPath = JsonPath.compile("$[*].number");
JSONArray titles = titlePath.read(content);
Iterator<Object> ids = ((JSONArray) idPath.read(content)).iterator();
JSONArray titles = titlePath.read(content);
Iterator<Object> ids = ((JSONArray) idPath.read(content)).iterator();
if (header) {
System.out.println(
"Changes in version " + JsonPath.read(content, "$[0].milestone.title") + " (" + LocalDate.now()
+ ")");
System.out.println("----------------------------------------");
}
if (header) {
System.out.println(
"Changes in version " + JsonPath.read(content, "$[0].milestone.title") + " (" + LocalDate.now()
+ ")");
System.out.println("----------------------------------------");
}
for (Object title : titles) {
for (Object title : titles) {
String format = String.format("- #%s - %s", ids.next(), title.toString().replaceAll("`", ""));
System.out.println(format.endsWith(".") ? format : format.concat("."));
}
}
String format = String.format("- #%s - %s", ids.next(), title.toString().replaceAll("`", ""));
System.out.println(format.endsWith(".") ? format : format.concat("."));
}
}
}