mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-26 18:20:59 +00:00
[RDNF #16] Fix for issue 2232: Many lines of "Could not find any stages to run" on run (#2272) (#157)
https://github.com/nektos/act/pull/2272 * Initial commit * Put the tests back * Remove unnecessary checks * Remove unneeded check and fix test code --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Andreas Taylor <Andy4495@users.noreply.github.com> Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/157 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: achyrva <achyrva@noreply.code.forgejo.org> Co-committed-by: achyrva <achyrva@noreply.code.forgejo.org>
This commit is contained in:
parent
2aef5fdde5
commit
3fe4f4fb7f
3 changed files with 7 additions and 11 deletions
|
@ -387,10 +387,6 @@ func createStages(w *Workflow, jobIDs ...string) ([]*Stage, error) {
|
||||||
stages = append(stages, stage)
|
stages = append(stages, stage)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(stages) == 0 {
|
|
||||||
return nil, fmt.Errorf("Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name")
|
|
||||||
}
|
|
||||||
|
|
||||||
return stages, nil
|
return stages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,13 +51,8 @@ func TestWorkflow(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that an invalid job id returns error
|
// Check that a valid job id returns non-error
|
||||||
result, err := createStages(&workflow, "invalid_job_id")
|
result, err := createStages(&workflow, "valid_job")
|
||||||
assert.NotNil(t, err)
|
|
||||||
assert.Nil(t, result)
|
|
||||||
|
|
||||||
// Check that an valid job id returns non-error
|
|
||||||
result, err = createStages(&workflow, "valid_job")
|
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.NotNil(t, result)
|
assert.NotNil(t, result)
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,6 +534,11 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||||
log.Debugf("Planning jobs for event: %s", eventName)
|
log.Debugf("Planning jobs for event: %s", eventName)
|
||||||
plan, plannerErr = planner.PlanEvent(eventName)
|
plan, plannerErr = planner.PlanEvent(eventName)
|
||||||
}
|
}
|
||||||
|
if plan != nil {
|
||||||
|
if len(plan.Stages) == 0 {
|
||||||
|
plannerErr = fmt.Errorf("Could not find any stages to run. View the valid jobs with `act --list`. Use `act --help` to find how to filter by Job ID/Workflow/Event Name")
|
||||||
|
}
|
||||||
|
}
|
||||||
if plan == nil && plannerErr != nil {
|
if plan == nil && plannerErr != nil {
|
||||||
return plannerErr
|
return plannerErr
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue