mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-06 17:40:58 +00:00
feature: Add support for github action variables (#1833)
* feature: Add support for github action variables * add --var flag for github variables * unitests: Updated unittests to cover vars context. * Remove syntax extension for vars and correct unit tests * Update pkg/runner/expression.go Co-authored-by: ChristopherHX <christopher.homberger@web.de> --------- Co-authored-by: kuanyong-wong-partior <kuanyong.wong@partior.com> Co-authored-by: ChristopherHX <christopher.homberger@web.de>
This commit is contained in:
parent
478b378cd6
commit
376c3ab8f3
7 changed files with 38 additions and 0 deletions
|
@ -19,6 +19,7 @@ type EvaluationEnvironment struct {
|
|||
Steps map[string]*model.StepResult
|
||||
Runner map[string]interface{}
|
||||
Secrets map[string]string
|
||||
Vars map[string]string
|
||||
Strategy map[string]interface{}
|
||||
Matrix map[string]interface{}
|
||||
Needs map[string]Needs
|
||||
|
@ -148,6 +149,7 @@ func (impl *interperterImpl) evaluateNode(exprNode actionlint.ExprNode) (interfa
|
|||
}
|
||||
}
|
||||
|
||||
// nolint:gocyclo
|
||||
func (impl *interperterImpl) evaluateVariable(variableNode *actionlint.VariableNode) (interface{}, error) {
|
||||
switch strings.ToLower(variableNode.Name) {
|
||||
case "github":
|
||||
|
@ -167,6 +169,8 @@ func (impl *interperterImpl) evaluateVariable(variableNode *actionlint.VariableN
|
|||
return impl.env.Runner, nil
|
||||
case "secrets":
|
||||
return impl.env.Secrets, nil
|
||||
case "vars":
|
||||
return impl.env.Vars, nil
|
||||
case "strategy":
|
||||
return impl.env.Strategy, nil
|
||||
case "matrix":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue