2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

fix: use ref param instead of branch for get_required_deps (GitHub contents API) (#1362)

* fix: use ref param instead of branch

* fix: use ref param instead of branch

* chore: unintentional changes from web editor

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
HENRY Florian 2022-08-28 14:29:10 +02:00 committed by GitHub
parent 589f7a400e
commit 9131ba05db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -181,11 +181,11 @@ def get_required_deps(org, name, branch, deps="hooks.py"):
import base64 import base64
git_api_url = f"https://api.github.com/repos/{org}/{name}/contents/{name}/{deps}" git_api_url = f"https://api.github.com/repos/{org}/{name}/contents/{name}/{deps}"
params = {"branch": branch or "develop"} params = {"ref": branch or "develop"}
res = requests.get(url=git_api_url, params=params).json() res = requests.get(url=git_api_url, params=params).json()
if "message" in res: if "message" in res:
git_url = f"https://raw.githubusercontent.com/{org}/{name}/{params['branch']}/{name}/{deps}" git_url = f"https://raw.githubusercontent.com/{org}/{name}/{params['ref']}/{name}/{deps}"
return requests.get(git_url).text return requests.get(git_url).text
return base64.decodebytes(res["content"].encode()).decode() return base64.decodebytes(res["content"].encode()).decode()