-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Affect
triage/needs-rebase
on Pull Requests with merge conflicts
This adds the `triage/needs-rebase` label (or removes it) on opened pull-requests, making it easier to find pull-requests that require a rebase to be merged
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/io/quarkus/bot/MarkPullRequestAsNeedsRebase.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,27 @@ | ||
package io.quarkus.bot; | ||
|
||
import io.quarkiverse.githubapp.event.Push; | ||
import io.quarkus.bot.util.Labels; | ||
import org.kohsuke.github.GHEventPayload; | ||
import org.kohsuke.github.GHIssueState; | ||
import org.kohsuke.github.GHPullRequest; | ||
import org.kohsuke.github.GHRepository; | ||
|
||
import java.io.IOException; | ||
|
||
public class MarkPullRequestAsNeedsRebase { | ||
|
||
void maintainNeedsRebaseLabel(@Push GHEventPayload.Push pushRequestPayload) throws IOException { | ||
GHRepository repository = pushRequestPayload.getRepository(); | ||
for (GHPullRequest pullRequest : repository.getPullRequests(GHIssueState.OPEN)) { | ||
Boolean mergeable = pullRequest.getMergeable(); | ||
if (mergeable != null) { | ||
if (mergeable) { | ||
pullRequest.removeLabels(Labels.TRIAGE_NEEDS_REBASE); | ||
} else { | ||
pullRequest.addLabels(Labels.TRIAGE_NEEDS_REBASE); | ||
} | ||
} | ||
} | ||
} | ||
} |
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