return SilentError if completed run failed

If `gh run watch ${ID} --exit-status` is run and "ID" is the ID of a
completed job that failed, return a SilentError. This ensures that the
program returns a non-zero code.

Fixes #3962
This commit is contained in:
Des Preston 2021-07-09 11:54:58 -04:00
parent a6710ec506
commit 1980cc83b9

View file

@ -123,6 +123,9 @@ func watchRun(opts *WatchOptions) error {
if run.Status == shared.Completed {
fmt.Fprintf(out, "Run %s (%s) has already completed with '%s'\n", cs.Bold(run.Name), cs.Cyanf("%d", run.ID), run.Conclusion)
if opts.ExitStatus && run.Conclusion != shared.Success {
return cmdutil.SilentError
}
return nil
}