-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fail if no stages were found #1970
fix: fail if no stages were found #1970
Conversation
Adds a warning message if act is cannot find any stages to run with the filters provided. Reproduction: - run `act -j gibberish` Desired behavior: some indication I did something silly Actual behavior: no output, just exit with success. As a human who often makes spelling mistakes, it would be nice if act warned me what I was doing that was silly rather than exiting apparently doing nothing with no obvious indication I did something wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make more sense to return an error from here:
Lines 331 to 358 in 7ba9f30
var err error | |
// next, build an execution graph | |
stages := make([]*Stage, 0) | |
for len(jobDependencies) > 0 { | |
stage := new(Stage) | |
for jID, jDeps := range jobDependencies { | |
// make sure all deps are in the graph already | |
if listInStages(jDeps, stages...) { | |
stage.Runs = append(stage.Runs, &Run{ | |
Workflow: w, | |
JobID: jID, | |
}) | |
delete(jobDependencies, jID) | |
} | |
} | |
if len(stage.Runs) == 0 { | |
return nil, fmt.Errorf("unable to build dependency graph for %s (%s)", w.Name, w.File) | |
} | |
stages = append(stages, stage) | |
} | |
if len(stages) == 0 && err != nil { | |
return nil, err | |
} | |
return stages, nil | |
} |
As you can see the
err
variable is unused, so I'd probably remove it and use the if len(stages) == 0
to return nil, fmt.Errorf("...")
@ctrlaltf24 this pull request has failed checks 🛠 |
This reverts commit 226adf1.
Errors if no stages were found with the given filters. Prints out a helpful error message, pointing users in the right place for how to specify which stage to run. Reproduction: - run `act -j gibberish` Desired behavior: some indication I did something silly Actual behavior: no output, just exit with success. As a human who often makes spelling mistakes, it would be nice if act warned me what I was doing that was silly rather than exiting apparently doing nothing with no obvious indication I did something wrong.
Codecov Report
@@ Coverage Diff @@
## master #1970 +/- ##
==========================================
+ Coverage 61.22% 62.12% +0.90%
==========================================
Files 46 52 +6
Lines 7141 8484 +1343
==========================================
+ Hits 4372 5271 +899
- Misses 2462 2794 +332
- Partials 307 419 +112
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Adds a warning message if act is cannot find any stages to run with the filters provided.
Reproduction:
act -j gibberish
Desired behavior: some indication I did something silly
Actual behavior: no output, just exit with success.
As a human who often makes spelling mistakes,
it would be nice if act warned me what I was doing that was silly rather than exiting apparently doing
nothing with no obvious indication
I did something wrong.
Alternative solutions: