Skip to content

Commit

Permalink
Only add labels to backport PRs when there are labels to add
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Feb 19, 2025
1 parent f0900b4 commit 8f85e8d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/net/neoforged/automation/command/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ public static CommandDispatcher<GHCommandContext> register(CommandDispatcher<GHC
newBranch, branch, body.toString()
);

createdPr.addLabels(source.pullRequest().getLabels()
var labelsToAdd = source.pullRequest().getLabels()
.stream()
.filter(l -> !l.getName().startsWith("1."))
.toList());
.toList();

if (!labelsToAdd.isEmpty()) {
createdPr.addLabels(labelsToAdd);
}

context.getSource().pullRequest()
.comment("Created backport PR: #" + createdPr.getNumber());
Expand Down

0 comments on commit 8f85e8d

Please # to comment.