-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdateextensioncatalog.java
executable file
·48 lines (40 loc) · 1.58 KB
/
updateextensioncatalog.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.quarkus.platform:quarkus-bom:3.2.2.Final@pom
//DEPS io.quarkus:quarkus-picocli
//DEPS org.kohsuke:github-api:1.315
//JAVA 21
//JAVAC_OPTIONS -parameters
//JAVA_OPTIONS -Djava.util.logging.manager=org.jboss.logmanager.LogManager
//Q:CONFIG quarkus.log.level=SEVERE
//Q:CONFIG quarkus.banner.enabled=false
import java.io.IOException;
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GHWorkflow;
import org.kohsuke.github.GitHub;
import org.kohsuke.github.GitHubBuilder;
import picocli.CommandLine.Command;
@Command(name = "updateextensioncatalog", mixinStandardHelpOptions = true)
public class updateextensioncatalog implements Runnable {
@Override
public void run() {
try {
GitHub github;
String releaseGitHubToken = System.getenv("RELEASE_GITHUB_TOKEN");
if (releaseGitHubToken != null && !releaseGitHubToken.isBlank()) {
github = new GitHubBuilder().withOAuthToken(releaseGitHubToken).build();
} else {
github = GitHubBuilder.fromPropertyFile().build();
}
GHRepository repository = github.getRepository("quarkusio/quarkus-extension-catalog");
GHWorkflow workflow = repository.getWorkflow("check_updates.yaml");
workflow.dispatch("main");
} catch (IOException e) {
e.printStackTrace();
fail("IOException was thrown, please see above");
}
}
private static void fail(String message) {
System.err.println(message);
System.exit(2);
}
}