Update get_repo_settings in bitbucket_provider.py to fetch file via API request

This commit is contained in:
Ori Kotek
2023-10-30 18:36:46 +02:00
parent 4bda9dfe04
commit 73bb70fef4

View File

@ -41,9 +41,10 @@ class BitbucketProvider(GitProvider):
def get_repo_settings(self): def get_repo_settings(self):
try: try:
contents = self.repo_obj.get_contents( url = (f"https://api.bitbucket.org/2.0/repositories/{self.workspace_slug}/{self.repo_slug}/src/"
".pr_agent.toml", ref=self.pr.head.sha f"{self.pr.destination_branch}/.pr_agent.toml")
).decoded_content response = requests.request("GET", url, headers=self.headers)
contents = response.text.encode('utf-8')
return contents return contents
except Exception: except Exception:
return "" return ""