Skip to content

Commit

Permalink
fix: Remove setting PR Status to closed (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
egekocabas authored Feb 3, 2025
1 parent 1002bfc commit 4960447
Showing 1 changed file with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.tum.cit.aet.helios.pullrequest.github;

import de.tum.cit.aet.helios.gitrepo.GitRepoRepository;
import de.tum.cit.aet.helios.issue.Issue;
import de.tum.cit.aet.helios.label.Label;
import de.tum.cit.aet.helios.label.LabelRepository;
import de.tum.cit.aet.helios.label.github.GitHubLabelConverter;
Expand Down Expand Up @@ -86,23 +85,10 @@ public List<GHPullRequest> syncPullRequestsOfRepository(
.iterator();

var pullRequests = new ArrayList<GHPullRequest>();
iterator.forEachRemaining(pullRequests::add);

// Close pull requests that are not present in the fetched list
List<Long> syncedPrIds = pullRequests.stream()
.map(GHPullRequest::getId)
.toList();

pullRequestRepository
.findAllByState(Issue.State.OPEN)
.stream()
.filter(pr -> !syncedPrIds.contains(pr.getId()))
.forEach(pr -> {
pr.setState(Issue.State.CLOSED);
pullRequestRepository.save(pr);
});

pullRequests.forEach(this::processPullRequest);
iterator.forEachRemaining(pullRequest -> {
pullRequests.add(pullRequest);
processPullRequest(pullRequest);
});
return pullRequests;
}

Expand Down

0 comments on commit 4960447

Please sign in to comment.