feat: add job id, into run view suggest command (#5105)
* feat: add job id, into run view suggest command * fix: dry * fix: run id to job id * Change "a" to "the" when referencing a single job Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
This commit is contained in:
parent
3a088e4df5
commit
b77c37df0f
2 changed files with 6 additions and 4 deletions
|
|
@ -362,8 +362,10 @@ func runView(opts *ViewOptions) error {
|
|||
fmt.Fprintln(out)
|
||||
if shared.IsFailureState(run.Conclusion) {
|
||||
fmt.Fprintf(out, "To see what failed, try: gh run view %d --log-failed\n", run.ID)
|
||||
} else if len(jobs) == 1 {
|
||||
fmt.Fprintf(out, "For more information about the job, try: gh run view --job=%d\n", jobs[0].ID)
|
||||
} else {
|
||||
fmt.Fprintln(out, "For more information about a job, try: gh run view --job=<job-id>")
|
||||
fmt.Fprintf(out, "For more information about a job, try: gh run view --job=<job-id>\n")
|
||||
}
|
||||
fmt.Fprintf(out, cs.Gray("View this run on GitHub: %s\n"), run.URL)
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.REST("GET", "repos/OWNER/REPO/check-runs/10/annotations"),
|
||||
httpmock.JSONResponse([]shared.Annotation{}))
|
||||
},
|
||||
wantOut: "\n✓ trunk successful #2898 · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\n\nFor more information about a job, try: gh run view --job=<job-id>\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
wantOut: "\n✓ trunk successful #2898 · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\n\nFor more information about the job, try: gh run view --job=10\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
},
|
||||
{
|
||||
name: "exit status, failed run",
|
||||
|
|
@ -308,7 +308,7 @@ func TestViewRun(t *testing.T) {
|
|||
httpmock.REST("GET", "repos/OWNER/REPO/check-runs/10/annotations"),
|
||||
httpmock.JSONResponse([]shared.Annotation{}))
|
||||
},
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\n\nFor more information about a job, try: gh run view --job=<job-id>\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\n\nFor more information about the job, try: gh run view --job=10\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
},
|
||||
{
|
||||
name: "verbose",
|
||||
|
|
@ -381,7 +381,7 @@ func TestViewRun(t *testing.T) {
|
|||
opts: &ViewOptions{
|
||||
Prompt: true,
|
||||
},
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\n\nFor more information about a job, try: gh run view --job=<job-id>\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
wantOut: "\n✓ trunk successful · 3\nTriggered via push about 59 minutes ago\n\nJOBS\n✓ cool job in 4m34s (ID 10)\n\nFor more information about the job, try: gh run view --job=10\nView this run on GitHub: https://github.com/runs/3\n",
|
||||
},
|
||||
{
|
||||
name: "interactive with log",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue