mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
using GITHUB_TOKEN to make API requests in scripts/get_env.py (#4033)
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -34,7 +34,11 @@ def get_commit_json(event):
|
||||
commit_url = event["pull_request"]["base"]["repo"]["commits_url"].replace(
|
||||
"{/sha}", f"/{event['pull_request']['head']['sha']}"
|
||||
)
|
||||
with urllib.request.urlopen(commit_url, context=context) as commit_file:
|
||||
request = urllib.request.Request(commit_url)
|
||||
if "GH_TOKEN" in os.environ:
|
||||
request.add_header("Authorization", "Bearer %s" % (os.environ["GH_TOKEN"]))
|
||||
|
||||
with urllib.request.urlopen(request, context=context) as commit_file:
|
||||
commit_json = json.loads(commit_file.read().decode("utf-8"))
|
||||
return commit_json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user