Skip to content

Commit

Permalink
Instead of using the current arguments, use the workflows state *afte…
Browse files Browse the repository at this point in the history
…r* merging arguments

This allows passing in values earlier in the workflow and thereby
decouples the workflow invokers from the workflow execution.

Without this change, the workflow invoker would need to know exactly
which step needs which parameters, which would be a case of tight
integration.
  • Loading branch information
ehuelsmann committed Jul 28, 2023
1 parent 8288e47 commit bead05e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Workflow/Action.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,19 @@ sub validate {
my @validators = $self->get_validators;
return unless ( scalar @validators );

my $context = $wf->context;
$action_args //= {};
my %all_args = (
%{ $wf->context->param() },
%{$action_args}
);
foreach my $validator_info (@validators) {
my $validator = $validator_info->{validator};
my $args = $validator_info->{args};

my @runtime_args = ();
foreach my $arg ( @{$args} ) {
if ( $arg =~ /^\$(.*)$/ ) {
push @runtime_args, $action_args->{$1};
push @runtime_args, $all_args{$1};
} else {
push @runtime_args, $arg;
}
Expand Down

0 comments on commit bead05e

Please sign in to comment.