about summary refs log tree commit diff
path: root/ops/besadii
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-21T22·06+0000
committerVincent Ambo <tazjin@google.com>2020-02-21T22·09+0000
commit0a34810e274bb2ca3dc8764733ec23b6b878d5bc (patch)
treeb2ce619d6465dc3779bceddef309b82eae7f50ee /ops/besadii
parent80c6680eda2afd2e9899f92d508d1b1907916756 (diff)
chore(ops/besadii): Fail if sourcehut token is unset
Diffstat (limited to 'ops/besadii')
-rw-r--r--ops/besadii/main.go9
1 files changed, 7 insertions, 2 deletions
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