-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aecb6a3
commit fb36890
Showing
5 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/net/neoforged/automation/webhook/label/KeepRebasedHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.neoforged.automation.webhook.label; | ||
|
||
import com.github.api.GetPullRequestQuery; | ||
import com.github.api.type.MergeableState; | ||
import net.neoforged.automation.webhook.handler.MergeConflictCheckHandler; | ||
import org.kohsuke.github.GHIssue; | ||
import org.kohsuke.github.GHLabel; | ||
import org.kohsuke.github.GHUser; | ||
import org.kohsuke.github.GitHub; | ||
import org.kohsuke.github.GitHubAccessor; | ||
|
||
public class KeepRebasedHandler implements LabelHandler { | ||
@Override | ||
public void onLabelAdded(GitHub gitHub, GHUser actor, GHIssue issue, GHLabel label) throws Exception { | ||
while (MergeConflictCheckHandler.checkConflict(gitHub, GitHubAccessor.graphQl(gitHub, GetPullRequestQuery.builder() | ||
.owner(issue.getRepository().getOwnerName()) | ||
.name(issue.getRepository().getName()) | ||
.number(issue.getNumber()) | ||
.build()) | ||
.repository() | ||
.pullRequest().fragments().pullRequestInfo()) == MergeableState.UNKNOWN) { | ||
Thread.sleep(MergeConflictCheckHandler.PR_BASE_TIME * 1000); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters