mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
fix: composite action input pollution (#818)
refuses to use the default for an nodejs input when an composite action has an input with the same name. clean cherry-pick (except for trivial context conflict) of two related pull requests - https://github.com/nektos/act/pull/2348 - https://github.com/nektos/act/pull/2473 <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/818): <!--number 818 --><!--line 0 --><!--description Zml4OiBjb21wb3NpdGUgYWN0aW9uIGlucHV0IHBvbGx1dGlvbg==-->fix: composite action input pollution<!--description--> <!--end release-notes-assistant--> Co-authored-by: ChristopherHX <christopher.homberger@web.de> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/818 Reviewed-by: Gusted <gusted@noreply.code.forgejo.org> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
931c2c0ac3
commit
b236cb64f9
18 changed files with 267 additions and 4 deletions
|
|
@ -262,6 +262,16 @@ func mergeEnv(ctx context.Context, step step) {
|
|||
}
|
||||
|
||||
rc.withGithubEnv(ctx, step.getGithubContext(ctx), *env)
|
||||
|
||||
if step.getStepModel().Uses != "" {
|
||||
// prevent uses action input pollution of unset parameters, skip this for run steps
|
||||
// due to design flaw
|
||||
for key := range *env {
|
||||
if strings.HasPrefix(key, "INPUT_") {
|
||||
delete(*env, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isStepEnabled(ctx context.Context, expr string, step step, stage stepStage) (bool, error) {
|
||||
|
|
@ -274,7 +284,7 @@ func isStepEnabled(ctx context.Context, expr string, step step, stage stepStage)
|
|||
defaultStatusCheck = exprparser.DefaultStatusCheckSuccess
|
||||
}
|
||||
|
||||
runStep, err := EvalBool(ctx, rc.NewStepExpressionEvaluator(ctx, step), expr, defaultStatusCheck)
|
||||
runStep, err := EvalBool(ctx, rc.NewStepExpressionEvaluatorExt(ctx, step, stage == stepStageMain), expr, defaultStatusCheck)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf(" \u274C Error in if-expression: \"if: %s\" (%s)", expr, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue