From 5b7f74ed91f399a0c93116f657d425c9163fa9f4 Mon Sep 17 00:00:00 2001
From: Martin Lowe <martin.lowe@eclipse-foundation.org>
Date: Wed, 26 Mar 2025 14:21:49 -0400
Subject: [PATCH] fix(gh): remove doubled umport of GithubHelper in webhook
 resource class

---
 .../git/eca/resource/GithubWebhooksResource.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

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 f4559d5..0705ad3 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());
     }
-- 
GitLab