|
| 1 | +package org.wildfly.bot; |
| 2 | + |
| 3 | +import io.quarkiverse.githubapp.ConfigFile; |
| 4 | +import io.quarkiverse.githubapp.event.WorkflowRun; |
| 5 | +import io.quarkus.bot.buildreporter.githubactions.BuildReporterConfig; |
| 6 | +import io.quarkus.bot.buildreporter.githubactions.BuildReporterEventHandler; |
| 7 | +import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; |
| 8 | +import jakarta.inject.Inject; |
| 9 | +import org.kohsuke.github.GHEventPayload; |
| 10 | +import org.kohsuke.github.GitHub; |
| 11 | +import org.wildfly.bot.config.WildFlyBotConfig; |
| 12 | +import org.wildfly.bot.model.WildFlyConfigFile; |
| 13 | + |
| 14 | +import java.io.IOException; |
| 15 | +import java.util.Set; |
| 16 | + |
| 17 | +import static org.wildfly.bot.model.RuntimeConstants.CONFIG_FILE_NAME; |
| 18 | + |
| 19 | +public class AnalyzeWorkflowResults { |
| 20 | + @Inject |
| 21 | + BuildReporterEventHandler buildReporterEventHandler; |
| 22 | + |
| 23 | + @Inject |
| 24 | + WildFlyBotConfig wildFlyBotConfig; |
| 25 | + |
| 26 | + void analyzeWorkflowResults(@WorkflowRun.Completed @WorkflowRun.Requested GHEventPayload.WorkflowRun workflowRunPayload, |
| 27 | + @ConfigFile(CONFIG_FILE_NAME) WildFlyConfigFile wildFlyConfigFile, |
| 28 | + GitHub gitHub, DynamicGraphQLClient gitHubGraphQLClient) throws IOException { |
| 29 | + BuildReporterConfig buildReporterConfig = BuildReporterConfig.builder() |
| 30 | + .dryRun(wildFlyBotConfig.isDryRun()) |
| 31 | + .workflowJobComparator((o1, o2) -> { |
| 32 | + return 0; |
| 33 | + }) |
| 34 | + .monitoredWorkflows(Set.of("Java CI with Maven")) |
| 35 | + .build(); |
| 36 | + |
| 37 | + buildReporterEventHandler.handle(workflowRunPayload, buildReporterConfig, gitHub, gitHubGraphQLClient); |
| 38 | + } |
| 39 | +} |
0 commit comments