Support different main branches in auto sheriff (#1383)

* Support different main branches in auto sheriff

* Check builds on the default branch of the pipeline in auto sheriff

* Fix indentation
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 88305dc..66435e0 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -694,6 +694,10 @@
         "https://api.buildkite.com/v2/organizations/{}/pipelines/{}/builds/{}/jobs/{}/retry"
     )
 
+    _PIPELINE_INFO_URL_TEMPLATE = (
+        "https://api.buildkite.com/v2/organizations/{}/pipelines/{}"
+    )
+
     def __init__(self, org, pipeline):
         self._org = org
         self._pipeline = pipeline
@@ -720,6 +724,20 @@
         except urllib.error.HTTPError as ex:
             raise BuildkiteException("Failed to open {}: {} - {}".format(url, ex.code, ex.reason))
 
+    def get_pipeline_info(self):
+        """Get details for a pipeline given its organization slug
+        and pipeline slug.
+        See https://buildkite.com/docs/apis/rest-api/pipelines#get-a-pipeline
+
+        Returns
+        -------
+        dict
+            the metadata for the pipeline
+        """
+        url = self._PIPELINE_INFO_URL_TEMPLATE.format(self._org, self._pipeline)
+        output = self._open_url(url)
+        return json.loads(output)
+
     def get_build_info(self, build_number):
         """Get build info for a pipeline with a given build number
         See https://buildkite.com/docs/apis/rest-api/builds#get-a-build