From ff734eb912792625317428cc1b9cfb21db651e95 Mon Sep 17 00:00:00 2001 From: Oleg Kopysov Date: Thu, 19 Sep 2024 17:25:11 +0300 Subject: [PATCH] fix: Apply changes after code review Signed-off-by: Oleg Kopysov --- .../com/lpvs/service/LPVSGitHubService.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/lpvs/service/LPVSGitHubService.java b/src/main/java/com/lpvs/service/LPVSGitHubService.java index 2139ca03..80ce36e0 100644 --- a/src/main/java/com/lpvs/service/LPVSGitHubService.java +++ b/src/main/java/com/lpvs/service/LPVSGitHubService.java @@ -317,17 +317,22 @@ public void commentResults( } } + // Generate hub link + String hubLink = ""; + if (!StringUtils.isBlank(webhookConfig.getHubLink())) { + hubLink = + "\n\n######

Check the validation details on the [website](" + + webhookConfig.getHubLink() + + ")

"; + } + if (hasProhibitedOrRestricted || hasConflicts) { lpvsPullRequest.setStatus(LPVSPullRequestStatus.ISSUES_DETECTED.toString()); pullRequestRepository.save(lpvsPullRequest); pullRequest.comment( "**\\[LPVS\\]** Potential license issues detected \n\n" + commitComment - + (!StringUtils.isBlank(webhookConfig.getHubLink()) - ? ("\n\n######

Check the validation details on the [website](" - + webhookConfig.getHubLink() - + ")

") - : "")); + + hubLink); repository.createCommitStatus( webhookConfig.getHeadCommitSHA(), GHCommitState.FAILURE, @@ -338,13 +343,7 @@ public void commentResults( lpvsPullRequest.setStatus(LPVSPullRequestStatus.COMPLETED.toString()); pullRequestRepository.save(lpvsPullRequest); pullRequest.comment( - "**\\[LPVS\\]** No license issue detected \n\n" - + commitComment - + (!StringUtils.isBlank(webhookConfig.getHubLink()) - ? ("\n\n######

Check the validation details on the [website](" - + webhookConfig.getHubLink() - + ")

") - : "")); + "**\\[LPVS\\]** No license issue detected \n\n" + commitComment + hubLink); repository.createCommitStatus( webhookConfig.getHeadCommitSHA(), GHCommitState.SUCCESS,