diff --git a/src/main/java/org/eclipsefoundation/git/eca/resource/GithubWebhooksResource.java b/src/main/java/org/eclipsefoundation/git/eca/resource/GithubWebhooksResource.java index f4559d562d990b12f44e5576afa7b5e10d6a338c..0705ad3e773b1da503a7d03177319e00105b1096 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/resource/GithubWebhooksResource.java +++ b/src/main/java/org/eclipsefoundation/git/eca/resource/GithubWebhooksResource.java @@ -57,8 +57,6 @@ public class GithubWebhooksResource extends CommonResource { @Inject GithubApplicationService ghAppService; - @Inject - GithubHelper validationHelper; @Inject CaptchaHelper captchaHelper; @Inject @@ -82,7 +80,7 @@ public class GithubWebhooksResource extends CommonResource { // If event isn't a pr or merge_group event, drop as we don't process them if ("merge_group".equalsIgnoreCase(eventType)) { // if we're in a merge_group, the HEAD SHA should already be validated, so we don't need to check again - validationHelper.sendMergeQueueStatus(request); + ghHelper.sendMergeQueueStatus(request); } else if ("pull_request".equalsIgnoreCase(eventType)) { // check that the pull request isn't somehow missing if (request.getPullRequest() == null) { @@ -91,7 +89,7 @@ public class GithubWebhooksResource extends CommonResource { PullRequest pr = request.getPullRequest(); // track the request before we start processing - GithubWebhookTracking tracking = validationHelper + GithubWebhookTracking tracking = ghHelper .retrieveAndUpdateTrackingInformation(wrapper, request.getInstallation().getId(), request.getRepository().getOwner().getLogin(), request.getRepository().getName(), pr); @@ -101,13 +99,13 @@ public class GithubWebhooksResource extends CommonResource { // prepare for validation process by pre-processing into standard format ValidationRequest vr = generateRequest(request, pr); // process the request - validationHelper.handleGithubWebhookValidation(request, vr, wrapper); + ghHelper.handleGithubWebhookValidation(request, vr, wrapper); } catch (Exception e) { // set the revalidation flag to reprocess if the initial attempt fails before exiting setRevalidationFlagForTracking(tracking); } } else if ("installation".equalsIgnoreCase(eventType)) { - // manually trigger the application installation update + // manually trigger the application installation update ghHelper.updateAppInstallationRecords(); } @@ -147,7 +145,7 @@ public class GithubWebhooksResource extends CommonResource { } // get the tracking if it exists, create it if it doesn't, and fail out if there is an issue - GithubWebhookTracking tracking = validationHelper + GithubWebhookTracking tracking = ghHelper .retrieveAndUpdateTrackingInformation(wrapper, installationId, orgName, repoName, prResponse.get()); if (tracking == null) { throw new ServerErrorException(String @@ -176,7 +174,7 @@ public class GithubWebhooksResource extends CommonResource { throw new ServerErrorException("Current validation is in a bad state, pull request information missing", Status.INTERNAL_SERVER_ERROR); } - boolean isSuccessful = validationHelper + boolean isSuccessful = ghHelper .handleGithubWebhookValidation(request, generateRequest(request, request.getPullRequest()), wrapper) .getPassed(); LOGGER.debug("Revalidation for request for '{}#{}' was {}successful.", sanitizedRepoName, prNo, isSuccessful ? "" : " not"); @@ -200,7 +198,7 @@ public class GithubWebhooksResource extends CommonResource { * @return the Validation Request body to be used in validating data */ private ValidationRequest generateRequest(GithubWebhookRequest request, PullRequest pr) { - return validationHelper + return ghHelper .generateRequest(request.getInstallation().getId(), request.getRepository().getOwner().getLogin(), request.getRepository().getName(), pr.getNumber(), request.getRepository().getHtmlUrl()); }