Get git_ref from buildbucket api in cocoon cipd build.

This is a postsubmit build and we should be getting the git_ref
from the buildbucket api. Currently the recipe is failing to upload
the device_doctor artifacts, because its not matching the
expected git_ref.

Bug:https://github.com/flutter/flutter/issues/117400
Change-Id: I419bcd93d284907733b9d9c93ac87c47ae16b59e
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/37622
Reviewed-by: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Jenn Magder <magder@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipes/cocoon/cipd.py b/recipes/cocoon/cipd.py
index 8d61099..c960e0a 100644
--- a/recipes/cocoon/cipd.py
+++ b/recipes/cocoon/cipd.py
@@ -31,7 +31,7 @@
       url=api.properties.get('git_url') or REPOS['cocoon'],
       ref=api.properties.get('git_ref') or 'refs/heads/main',
   )
-  should_upload = api.properties.get('git_ref') == 'refs/heads/main'
+  should_upload = api.buildbucket.gitiles_commit.ref == 'refs/heads/main'
   # Get properties from ci.yaml.
   # Assume ci.yaml has the following properties
   #   - name: Mac codesign