Skip to content

Commit

Permalink
fix: renovate check last pr issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Syed-Ali-Abbas-Zaidi committed Oct 18, 2023
1 parent 48efde9 commit 05dce90
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 = {

Check warning on line 57 in repo_health/check_renovate.py

View check run for this annotation

Codecov / codecov/patch

repo_health/check_renovate.py#L57

Added line #L57 was not covered by tests
"filter": f"repo:edx/{repo.name} type:pr author:app/renovate"
}
kwargs_open_edx = {

Check warning on line 60 in repo_health/check_renovate.py

View check run for this annotation

Codecov / codecov/patch

repo_health/check_renovate.py#L60

Added line #L60 was not covered by tests
"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={

Check warning on line 71 in repo_health/check_renovate.py

View check run for this annotation

Codecov / codecov/patch

repo_health/check_renovate.py#L70-L71

Added lines #L70 - L71 were not covered by tests
"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 = {

Check warning on line 85 in repo_health/check_renovate.py

View check run for this annotation

Codecov / codecov/patch

repo_health/check_renovate.py#L85

Added line #L85 was not covered by tests
"filter": f"repo:edx/{repo.name} type:pr author:app/renovate is:open"
}
kwargs_open_edx = {

Check warning on line 88 in repo_health/check_renovate.py

View check run for this annotation

Codecov / codecov/patch

repo_health/check_renovate.py#L88

Added line #L88 was not covered by tests
"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={

Check warning on line 101 in repo_health/check_renovate.py

View check run for this annotation

Codecov / codecov/patch

repo_health/check_renovate.py#L100-L101

Added lines #L100 - L101 were not covered by tests
"query": TOTAL_PR_QUERY,
"variables": kwargs_edx
})

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

Expand Down

0 comments on commit 05dce90

Please sign in to comment.