Skip to content

Commit

Permalink
Type check SHA response (#322)
Browse files Browse the repository at this point in the history
* Type check SHA response

* Avoid calling response.json() twice

---------

Co-authored-by: Brandon Squizzato <bsquizza@redhat.com>
  • Loading branch information
adamrdrew and bsquizz authored Aug 24, 2023
1 parent b42bf37 commit 74f9ec2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bonfire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ def get_ref_func(ref):
)

response = self._get_ref(get_ref_func)
return response.json()["object"]["sha"]
response_json = response.json()
if isinstance(response_json, list):
return response_json[0]["object"]["sha"]
return response_json["object"]["sha"]

def _fetch_github(self):
commit = self.ref
Expand Down

0 comments on commit 74f9ec2

Please sign in to comment.