Skip to content

Commit

Permalink
Do not sync pull request twice
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanNemeth committed Nov 26, 2024
1 parent 93c0dd6 commit 7369ec9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
4 changes: 2 additions & 2 deletions server/application-server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DATASOURCE_URL=jdbc:postgresql://127.0.0.1/helios
DATASOURCE_USERNAME=helios
DATASOURCE_PASSWORD=helios
NATS_SERVER=localhost:4222
NATS_AUTH_TOKEN='5760e8ae09adfb2756f9f8cd5cb2caa704cd3f549eaa9298be843ceb165185d815b81f90c680fa7f626b7cd63abf6ac9'
NATS_AUTH_TOKEN=5760e8ae09adfb2756f9f8cd5cb2caa704cd3f549eaa9298be843ceb165185d815b81f90c680fa7f626b7cd63abf6ac9
REPOSITORY_NAME=<repository_name e.g. ls1intum/Helios>
ORGANIZATION_NAME=<organization_name e.g. ls1intum>
GITHUB_AUTH_TOKEN=
GITHUB_AUTH_TOKEN=
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@

import de.tum.cit.aet.helios.github.GitHubMessageHandler;
import de.tum.cit.aet.helios.gitrepo.github.GitHubRepositorySyncService;
import de.tum.cit.aet.helios.pullrequest.github.GitHubPullRequestSyncService;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Component
public class GitHubWorkflowRunMessageHandler extends GitHubMessageHandler<GHEventPayload.WorkflowRun> {
private final GitHubRepositorySyncService repositorySyncService;
private final GitHubPullRequestSyncService pullRequestSyncService;
private final GitHubWorkflowSyncService workflowSyncService;

private GitHubWorkflowRunMessageHandler(
GitHubWorkflowSyncService workflowSyncService,
GitHubRepositorySyncService repositorySyncService,
GitHubPullRequestSyncService pullRequestSyncService) {
GitHubRepositorySyncService repositorySyncService) {
super(GHEventPayload.WorkflowRun.class);

this.workflowSyncService = workflowSyncService;
this.repositorySyncService = repositorySyncService;
this.pullRequestSyncService = pullRequestSyncService;
}

@Override
Expand All @@ -39,15 +35,6 @@ protected void handleEvent(GHEventPayload.WorkflowRun eventPayload) {
action);

repositorySyncService.processRepository(eventPayload.getRepository());

try {
run.getPullRequests().forEach(pullRequest -> {
pullRequestSyncService.processPullRequest(pullRequest);
});
} catch (Exception e) {
log.error("Failed to process pull requests for workflow run {}: {}", run.getUrl(), e.getMessage());
}

workflowSyncService.processRun(run);
}

Expand Down

0 comments on commit 7369ec9

Please sign in to comment.