From cdc6d4bc6a386ad68996cd4e51df4284740b988f Mon Sep 17 00:00:00 2001 From: sillyguodong Date: Mon, 17 Jul 2023 03:46:34 +0000 Subject: [PATCH] Support expression in `uses` (#75) Since actions can specify the download source via a url prefix. The prefix may contain some sensitive information that needs to be stored in secrets or variable context, so we need to interpolate the expression value for`uses` firstly. Reviewed-on: https://gitea.com/gitea/act/pulls/75 Co-authored-by: sillyguodong Co-committed-by: sillyguodong --- pkg/runner/step_action_remote.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/runner/step_action_remote.go b/pkg/runner/step_action_remote.go index c113284..4aca8f5 100644 --- a/pkg/runner/step_action_remote.go +++ b/pkg/runner/step_action_remote.go @@ -39,6 +39,12 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor { return nil } + // For gitea: + // Since actions can specify the download source via a url prefix. + // The prefix may contain some sensitive information that needs to be stored in secrets, + // so we need to interpolate the expression value for uses first. + sar.Step.Uses = sar.RunContext.NewExpressionEvaluator(ctx).Interpolate(ctx, sar.Step.Uses) + sar.remoteAction = newRemoteAction(sar.Step.Uses) if sar.remoteAction == nil { return fmt.Errorf("Expected format {org}/{repo}[/path]@ref. Actual '%s' Input string was not in a correct format", sar.Step.Uses)