From 74f9bd0a64474c4c9748b1e617a05e72a420c267 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Wed, 18 Oct 2023 11:56:22 +0500 Subject: [PATCH] fix: renovate check last pr issue --- repo_health/check_renovate.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/repo_health/check_renovate.py b/repo_health/check_renovate.py index 85a3e2ec..16a404a0 100644 --- a/repo_health/check_renovate.py +++ b/repo_health/check_renovate.py @@ -54,15 +54,25 @@ async def get_last_pull_date(github_repo): """ repo = github_repo.object client = repo.http - kwargs = { + kwargs_edx = { "filter": f"repo:edx/{repo.name} type:pr author:app/renovate" } + kwargs_open_edx = { + "filter": f"repo:openedx/{repo.name} type:pr author:app/renovate" + } _json = { "query": LAST_PR_QUERY, - "variables": kwargs, + "variables": kwargs_edx, } data = await client.request(json=_json) + + if not data['search']['nodes']: + data = await client.request(json={ + "query": LAST_PR_QUERY, + "variables": kwargs_open_edx + }) + if len(data['search']['nodes']): return data['search']['nodes'][0]['createdAt'][:10] @@ -72,18 +82,27 @@ async def get_total_and_oldest_renovate_pull_requests(github_repo): """ repo = github_repo.object client = repo.http - kwargs = { + kwargs_edx = { + "filter": f"repo:edx/{repo.name} type:pr author:app/renovate is:open" + } + kwargs_open_edx = { "filter": f"repo:openedx/{repo.name} type:pr author:app/renovate is:open" } _json = { "query": TOTAL_PR_QUERY, - "variables": kwargs, + "variables": kwargs_open_edx, } try: data = await client.request(json=_json) + if not data['search']['nodes']: + data = await client.request(json={ + "query": LAST_PR_QUERY, + "variables": kwargs_edx + }) + total_open_prs = len(data['search']['nodes']) oldest_pr_date = None