make curl fail loudly for non-2xx downloads

`curl` fails silently if the status code of the response is not 2xx. This CL makes it fail loudly, and break the pipe.

Closes #11800.

PiperOrigin-RevId: 322353682
diff --git a/scripts/url-for-sheriff.sh b/scripts/url-for-sheriff.sh
index b49faf4..83b0f64 100755
--- a/scripts/url-for-sheriff.sh
+++ b/scripts/url-for-sheriff.sh
@@ -17,7 +17,7 @@
 # Prints a github URL for all bugs sheriff needs to look at
 # (open, no category assigned)
 
-NO_LABELS=$(curl https://api.github.com/repos/bazelbuild/bazel/labels 2>/dev/null | grep "url" | awk -f <(cat - <<-'EOD'
+NO_LABELS=$(curl -f https://api.github.com/repos/bazelbuild/bazel/labels 2>/dev/null | grep "url" | awk -f <(cat - <<-'EOD'
   BEGIN {
     ORS = ""
   }