Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
buildSrc/src/main/java/com/ishland/c2me/gradle/ParseGItHubActionChangelog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.ishland.c2me.gradle; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public class ParseGItHubActionChangelog { | ||
|
||
public static String getChangelog() throws Throwable { | ||
final String path = System.getenv("GITHUB_EVENT_RAW_PATH"); | ||
if (path == null || path.isBlank()) return "No changelog was specified. "; | ||
final JsonObject jsonObject = new Gson().fromJson(Files.readString(Path.of(path)), JsonObject.class); | ||
|
||
StringBuilder builder = new StringBuilder(); | ||
builder.append("This version is uploaded automatically by GitHub Actions. \n\n") | ||
.append("Changelog: \n"); | ||
final JsonArray commits = jsonObject.getAsJsonArray("commits"); | ||
if (commits.isEmpty()) { | ||
builder.append("No changes detected. \n"); | ||
} else { | ||
for (JsonElement commit : commits) { | ||
JsonObject object = commit.getAsJsonObject(); | ||
builder.append("- "); | ||
builder.append('[').append(object.get("id").getAsString(), 0, 8).append(']') | ||
.append('(').append(object.get("url").getAsString()).append(')'); | ||
builder.append(' '); | ||
builder.append(object.get("message").getAsString().split("\n")[0]); | ||
builder.append(" — "); | ||
builder.append(object.get("author").getAsJsonObject().get("name").getAsString()); | ||
builder.append(" ").append('\n'); | ||
} | ||
} | ||
return builder.toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |