Skip to content

Commit 1980cc8

Browse files
committed
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 cli#3962
1 parent a6710ec commit 1980cc8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/cmd/run/watch/watch.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ func watchRun(opts *WatchOptions) error {
123123

124124
if run.Status == shared.Completed {
125125
fmt.Fprintf(out, "Run %s (%s) has already completed with '%s'\n", cs.Bold(run.Name), cs.Cyanf("%d", run.ID), run.Conclusion)
126+
if opts.ExitStatus && run.Conclusion != shared.Success {
127+
return cmdutil.SilentError
128+
}
126129
return nil
127130
}
128131

0 commit comments

Comments
 (0)