Skip to content

Commit

Permalink
fix: renovate check last pr issue (openedx#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed-Ali-Abbas-Zaidi authored Oct 19, 2023
1 parent 48efde9 commit 3af58fb
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions repo_health/check_renovate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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": TOTAL_PR_QUERY,
"variables": kwargs_edx
})

total_open_prs = len(data['search']['nodes'])
oldest_pr_date = None

Expand Down

0 comments on commit 3af58fb

Please sign in to comment.