Skip to content

Commit 35b488a

Browse files
committed
Added some helpful methods
1 parent 1e8f399 commit 35b488a

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/main/java/io/github/intisy/utils/api/GitHub.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,11 @@ public String getLatestTag() {
660660
}
661661
throw new RuntimeException("Could not find an valid asset");
662662
}
663+
664+
public String getLastSha() throws IOException {
665+
return getLastCommit().getAsJsonArray().get(0).getAsJsonObject().get("sha").getAsString();
666+
}
667+
663668
public void jar(File direction, GHAsset asset, String repoName, String repoOwner) throws IOException {
664669
String assetName = asset.getName();
665670
String downloadUrl = "https://api.github.com/repos/" + repoOwner + "/" + repoName + "/releases/assets/" + asset.getId();

src/main/java/io/github/intisy/utils/utils/ThreadUtils.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22

33
@SuppressWarnings({"unused", "InfiniteLoopStatement"})
44
public class ThreadUtils {
5-
public static void done() {
5+
public static void sleep() {
66
while (true)
77
ThreadUtils.sleep(1000);
88
}
9+
910
public static void sleep(int milliseconds) {
1011
try {
1112
Thread.sleep(milliseconds);
1213
} catch (InterruptedException e) {
1314
throw new RuntimeException(e);
1415
}
1516
}
17+
18+
public static String getThreadName() {
19+
return Thread.currentThread().getName();
20+
}
21+
22+
public static void printThreadName() {
23+
System.out.println("Current thread: " + ThreadUtils.getThreadName());
24+
}
1625
}

0 commit comments

Comments
 (0)