fix: added ability to use github action token when commenting on PR

This commit is contained in:
Anmol Singh
2023-02-26 01:52:51 +05:30
parent 8bd25d079c
commit 3b5a864a2b
4 changed files with 5 additions and 3 deletions

View File

@@ -250,7 +250,7 @@ class DownloadManager:
:param kwargs: Parameters for substitution of variables in dynamic query.
:return: Response JSON dictionary.
"""
headers = {"Authorization": f"Bearer {EM.GH_TOKEN}"}
headers = {"Authorization": f"Bearer {EM.GH_TOKEN if not kwargs.get('use_github_action', False) else EM.CURRENT_GITHUB_ACTION_TOKEN}"}
res = await DownloadManager._client.post("https://api.github.com/graphql", json={"query": Template(GITHUB_API_QUERIES[query]).substitute(kwargs)}, headers=headers)
if res.status_code == 200:
return res.json()