From 8a0f0a5d6d8d198becace2ad3597a1438d15f408 Mon Sep 17 00:00:00 2001 From: Matyrobbrt Date: Sun, 11 Aug 2024 23:57:13 +0300 Subject: [PATCH] Fix command argument order --- .../automation/command/Commands.java | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/net/neoforged/automation/command/Commands.java b/src/main/java/net/neoforged/automation/command/Commands.java index 4ec660e..ea9f500 100644 --- a/src/main/java/net/neoforged/automation/command/Commands.java +++ b/src/main/java/net/neoforged/automation/command/Commands.java @@ -16,34 +16,34 @@ public class Commands { public static CommandDispatcher register(CommandDispatcher dispatcher) { dispatcher.register(literal("run") .requires(Requirement.IS_PR.and(Requirement.IS_MAINTAINER.or(Requirement.IS_PR))) - .then(argument("tasks", StringArgumentType.greedyString())) - .executes(FunctionalInterfaces.throwingCommand(context -> { - var pr = context.getSource().pullRequest(); - var config = Configuration.get(); - var repoConfig = Configuration.get(context.getSource().repository()); - if (repoConfig.baseRunCommand() != null) { - var tasks = context.getArgument("tasks", String.class).trim(); - var comment = pr.comment("Running Gradle tasks `" + tasks + "`..."); - FormattingCommand.run( - context.getSource().gitHub(), pr, - config.prActions(), repoConfig, - Arrays.stream(tasks.split(" ")).map(t -> "./gradlew " + t).collect(Collectors.joining(" && ")), - err -> { - context.getSource().onError().run(); - try { - context.getSource().issue() - .comment("Workflow failed: " + err.getHtmlUrl()); - } catch (Exception ex) { - throw new RuntimeException(ex); + .then(argument("tasks", StringArgumentType.greedyString()) + .executes(FunctionalInterfaces.throwingCommand(context -> { + var pr = context.getSource().pullRequest(); + var config = Configuration.get(); + var repoConfig = Configuration.get(context.getSource().repository()); + if (repoConfig.baseRunCommand() != null) { + var tasks = context.getArgument("tasks", String.class).trim(); + var comment = pr.comment("Running Gradle tasks `" + tasks + "`..."); + FormattingCommand.run( + context.getSource().gitHub(), pr, + config.prActions(), repoConfig, + Arrays.stream(tasks.split(" ")).map(t -> "./gradlew " + t).collect(Collectors.joining(" && ")), + err -> { + context.getSource().onError().run(); + try { + context.getSource().issue() + .comment("Workflow failed: " + err.getHtmlUrl()); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + }, () -> { + context.getSource().onSuccess().run(); + FunctionalInterfaces.ignoreExceptions(comment::delete); } - }, () -> { - context.getSource().onSuccess().run(); - FunctionalInterfaces.ignoreExceptions(comment::delete); - } - ); - } - return GHCommandContext.DEFERRED_RESPONSE; - }))); + ); + } + return GHCommandContext.DEFERRED_RESPONSE; + })))); return dispatcher; }