Skip to content

Commit

Permalink
fix: move getCommitMessage to renderCommitMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
mgabelle committed Dec 4, 2024
1 parent 462a917 commit 7689fed
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/main/java/io/kestra/plugin/git/AbstractGitTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
@NoArgsConstructor
@Getter
public abstract class AbstractGitTask extends Task {
private static final Pattern PEBBLE_TEMPLATE_PATTERN = Pattern.compile("^\\s*\\{\\{");

@Schema(
title = "The URI to clone from."
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/kestra/plugin/git/AbstractPushTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public abstract class AbstractPushTask<O extends AbstractPushTask.Output> extend
)
private Property<String> authorName;

public abstract String getCommitMessage(RunContext runContext) throws IllegalVariableEvaluationException;
public String renderCommitMessage(RunContext runContext) throws IllegalVariableEvaluationException {
return runContext.render(this.getCommitMessage()).as(String.class).orElseThrow();
}

public abstract Property<String> getGitDirectory();

Expand Down Expand Up @@ -214,7 +216,7 @@ private Output push(Git git, RunContext runContext, GitService gitService) throw
renderedBranch
);

String message = runContext.render(this.getCommitMessage(runContext));
String message = this.renderCommitMessage(runContext);
ObjectId head = git.getRepository().resolve(Constants.HEAD);
commit = git.commit()
.setAllowEmpty(false)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/kestra/plugin/git/PushFlows.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ By default, all flows from the specified sourceNamespace will be pushed (and opt
defaultValue = "Add flows from sourceNamespace"
)
@Override
public String getCommitMessage(RunContext runContext) throws IllegalVariableEvaluationException {
public String renderCommitMessage(RunContext runContext) throws IllegalVariableEvaluationException {
return runContext.render(this.commitMessage).as(String.class)
.orElse("Add flows from " + runContext.render(this.sourceNamespace).as(String.class).orElseThrow() + " namespace");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/kestra/plugin/git/PushNamespaceFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Given that this is a glob pattern string (or a list of glob patterns), you can i
defaultValue = "Add files from `namespace` namespace"
)
@Override
public String getCommitMessage(RunContext runContext) throws IllegalVariableEvaluationException {
public String renderCommitMessage(RunContext runContext) throws IllegalVariableEvaluationException {
return runContext.render(this.commitMessage)
.as(String.class)
.orElse("Add files from " + runContext.render(this.namespace).as(String.class).orElse(null) + " namespace");
Expand Down

0 comments on commit 7689fed

Please sign in to comment.