From 0a34810e274bb2ca3dc8764733ec23b6b878d5bc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 21 Feb 2020 22:06:56 +0000 Subject: chore(ops/besadii): Fail if sourcehut token is unset --- ops/besadii/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ops/besadii') diff --git a/ops/besadii/main.go b/ops/besadii/main.go index e9feadd9538e..c417cb0a1279 100644 --- a/ops/besadii/main.go +++ b/ops/besadii/main.go @@ -94,12 +94,17 @@ func triggerBuild(branch, commit string) { log.Fatalln("[ERROR] failed to create an HTTP request:", err) } - req.Header.Add("Authorization", fmt.Sprintf("token %s", os.Getenv("SRHT_TOKEN"))) + token := fmt.Sprintf("token %s", os.Getenv("SRHT_TOKEN")) + if token == "" { + log.Fatalln("[ERROR] sourcehut token is not set") + } + + req.Header.Add("Authorization", ) req.Header.Add("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { - // This might indicate a temporary error on the SourceHut side, do + // This might indicate a temporary error on the sourcehut side, do // not fail the whole program. log.Println("failed to send builds.sr.ht request:", err) return -- cgit 1.4.1