* Potentially solved merge conflict

* Update pkg/model/planner.go

Based on feedback

Co-authored-by: Ryan (hackercat) <me@hackerc.at>

* Fixed compilation error

* added missed test

* Fixed spelling error to work with lint error

Co-authored-by: Ryan (hackercat) <me@hackerc.at>
Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Renstrom
2021-05-05 22:04:03 +02:00
committed by GitHub
parent 596e518fe9
commit aba4fec0ee
5 changed files with 87 additions and 6 deletions

View File

@@ -229,7 +229,7 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor {
Success: true,
Outputs: make(map[string]string),
}
runStep, err := rc.EvalBool(sc.Step.If)
runStep, err := rc.EvalBool(sc.Step.If.Value)
if err != nil {
common.Logger(ctx).Errorf(" \u274C Error in if: expression - %s", sc.Step)
@@ -243,7 +243,7 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor {
}
if !runStep {
log.Debugf("Skipping step '%s' due to '%s'", sc.Step.String(), sc.Step.If)
log.Debugf("Skipping step '%s' due to '%s'", sc.Step.String(), sc.Step.If.Value)
return nil
}
@@ -298,13 +298,13 @@ func (rc *RunContext) platformImage() string {
func (rc *RunContext) isEnabled(ctx context.Context) bool {
job := rc.Run.Job()
l := common.Logger(ctx)
runJob, err := rc.EvalBool(job.If)
runJob, err := rc.EvalBool(job.If.Value)
if err != nil {
common.Logger(ctx).Errorf(" \u274C Error in if: expression - %s", job.Name)
return false
}
if !runJob {
l.Debugf("Skipping job '%s' due to '%s'", job.Name, job.If)
l.Debugf("Skipping job '%s' due to '%s'", job.Name, job.If.Value)
return false
}

View File

@@ -106,6 +106,7 @@ func TestRunEvent(t *testing.T) {
{"testdata", "defaults-run", "push", "", platforms, ""},
{"testdata", "uses-composite", "push", "", platforms, ""},
{"testdata", "issue-597", "push", "", platforms, ""},
{"testdata", "issue-598", "push", "", platforms, ""},
// {"testdata", "issue-228", "push", "", platforms, ""}, // TODO [igni]: Remove this once everything passes
// single test for different architecture: linux/arm64

View File

@@ -0,0 +1,31 @@
name: issue-598
on: push
jobs:
my_first_job:
runs-on: ubuntu-latest
steps:
- name: My first false step
if: "endsWith('Hello world', 'o1')"
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: 'Mona the Octocat'
- name: My first true step
if: "!endsWith('Hello world', 'od')"
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: "Renst the Octocat"
- name: My second false step
if: "endsWith('Hello world', 'o2')"
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: 'Act the Octocat'
- name: My third false step
if: "endsWith('Hello world', 'o2')"
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: 'Git the Octocat'