pr_number is an integer

This commit is contained in:
pseusys
2023-02-26 09:30:49 +01:00
parent 30c30d2c89
commit 2e2497e302
2 changed files with 3 additions and 5 deletions

View File

@@ -227,15 +227,14 @@ class DownloadManager:
return await DownloadManager._get_remote_resource(resource, safe_load) return await DownloadManager._get_remote_resource(resource, safe_load)
@staticmethod @staticmethod
async def _fetch_graphql_query(query: str, use_github_action: bool = False, **kwargs) -> Dict: async def _fetch_graphql_query(query: str, **kwargs) -> Dict:
""" """
Execute GitHub GraphQL API simple query. Execute GitHub GraphQL API simple query.
:param query: Dynamic query identifier. :param query: Dynamic query identifier.
:param use_github_action: Whether to perform query using CURRENT_GITHUB_ACTION_TOKEN.
:param kwargs: Parameters for substitution of variables in dynamic query. :param kwargs: Parameters for substitution of variables in dynamic query.
:return: Response JSON dictionary. :return: Response JSON dictionary.
""" """
headers = {"Authorization": f"Bearer {EM.GH_TOKEN if not use_github_action else EM.CURRENT_GITHUB_ACTION_TOKEN}"} headers = {"Authorization": f"Bearer {EM.GH_TOKEN}"}
res = await DownloadManager._client.post( res = await DownloadManager._client.post(
"https://api.github.com/graphql", json={"query": Template(GITHUB_API_QUERIES[query]).substitute(kwargs)}, headers=headers "https://api.github.com/graphql", json={"query": Template(GITHUB_API_QUERIES[query]).substitute(kwargs)}, headers=headers
) )

View File

@@ -46,5 +46,4 @@ class EnvironmentManager:
DEBUG_LOGGING = getenv("INPUT_DEBUG_LOGGING", "0").lower() in _TRUTHY DEBUG_LOGGING = getenv("INPUT_DEBUG_LOGGING", "0").lower() in _TRUTHY
DEBUG_RUN = getenv("DEBUG_RUN", "False").lower() in _TRUTHY DEBUG_RUN = getenv("DEBUG_RUN", "False").lower() in _TRUTHY
PR_NUMBER = getenv("PR_NUMBER", "") PR_NUMBER = int(getenv("PR_NUMBER", "0"))
CURRENT_GITHUB_ACTION_TOKEN = getenv("CURRENT_GITHUB_ACTION_TOKEN", "")