internal/relui: pass advisory trybot when context canceled

When an advisory trybot run times out, the context is canceled.
The trybot will never complete successfully with a canceled context.
This change records the failure and approves the trybot run.

For golang/go#57725

Change-Id: I79ba2d9cf32c91180cbce70f5b51426aaa11a704
Reviewed-on: https://go-review.googlesource.com/c/build/+/464299
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
diff --git a/internal/relui/workflows.go b/internal/relui/workflows.go
index 47a3226..f96b4d2 100644
--- a/internal/relui/workflows.go
+++ b/internal/relui/workflows.go
@@ -10,6 +10,7 @@
 	"compress/gzip"
 	"context"
 	"crypto/sha256"
+	"errors"
 	"fmt"
 	"io"
 	"io/fs"
@@ -774,6 +775,10 @@
 			ctx.Printf("Trybot Attempt failed: %v\n", err)
 		}
 	}
+	if errors.Is(ctx.Context.Err(), context.Canceled) {
+		ctx.Printf("Advisory TryBot timed out or was canceled\n")
+		return tryBotResult{bc.Name, passed}, nil
+	}
 	if !passed {
 		ctx.Printf("Advisory TryBot failed. Check the logs and approve this task if it's okay:\n")
 		return tryBotResult{bc.Name, passed}, b.ApproveAction(ctx)