parent
e33606361f
commit
af970769d7
3 changed files with 25 additions and 0 deletions
|
@ -231,11 +231,14 @@ func (rc *RunContext) isEnabled(ctx context.Context) bool {
|
||||||
// EvalBool evaluates an expression against current run context
|
// EvalBool evaluates an expression against current run context
|
||||||
func (rc *RunContext) EvalBool(expr string) bool {
|
func (rc *RunContext) EvalBool(expr string) bool {
|
||||||
if expr != "" {
|
if expr != "" {
|
||||||
|
//v, err := rc.ExprEval.Evaluate(fmt.Sprintf("if (%s) { true } else { false }", expr))
|
||||||
|
expr := fmt.Sprintf("Boolean(%s)", expr)
|
||||||
v, err := rc.ExprEval.Evaluate(expr)
|
v, err := rc.ExprEval.Evaluate(expr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Error evaluating expression '%s' - %v", expr, err)
|
log.Errorf("Error evaluating expression '%s' - %v", expr, err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
log.Debugf("expression '%s' evaluated to '%s'", expr, v)
|
||||||
return v == "true"
|
return v == "true"
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
7
pkg/runner/testdata/commands/push.yml
vendored
7
pkg/runner/testdata/commands/push.yml
vendored
|
@ -11,11 +11,18 @@ jobs:
|
||||||
run: echo $foo | grep bar
|
run: echo $foo | grep bar
|
||||||
|
|
||||||
- name: TEST set-output
|
- name: TEST set-output
|
||||||
|
id: set_output
|
||||||
run: echo "::set-output name=zoo::zar"
|
run: echo "::set-output name=zoo::zar"
|
||||||
|
|
||||||
#- run: echo "::add-path::/zip"
|
#- run: echo "::add-path::/zip"
|
||||||
#- run: echo $PATH | grep /zip
|
#- run: echo $PATH | grep /zip
|
||||||
|
|
||||||
|
- name: TEST conditional
|
||||||
|
if: steps.set_output.outputs.zoo
|
||||||
|
run: echo "::set-env name=cond_env::foo"
|
||||||
|
- name: TEST conditional (cont.)
|
||||||
|
run: echo $cond_env | grep foo
|
||||||
|
|
||||||
- name: TEST debug, warning, error
|
- name: TEST debug, warning, error
|
||||||
run: |
|
run: |
|
||||||
echo "::debug file=app.js,line=100,col=20::Hello debug!"
|
echo "::debug file=app.js,line=100,col=20::Hello debug!"
|
||||||
|
|
15
pkg/runner/testdata/issue-104/main.yaml
vendored
Normal file
15
pkg/runner/testdata/issue-104/main.yaml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
name: Test stuff
|
||||||
|
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Testing Testing
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: hello
|
||||||
|
uses: actions/hello-world-docker-action@master
|
||||||
|
with:
|
||||||
|
who-to-greet: "World"
|
Loading…
Reference in a new issue