Skip to content

Commit

Permalink
update issues count
Browse files Browse the repository at this point in the history
  • Loading branch information
James Wood authored and James Wood committed Nov 23, 2024
1 parent 5a5ab18 commit e3c409d
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions hitide_repos/hitide_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,31 @@ def get_open_issues_count(repo_name, github_token):
# Define the parameters to get only open issues (not pull requests)
params = {
'state': 'open', # Only open issues
'per_page': 100, # Get up to 100 issues per page (max allowed by GitHub)
}

# Make the request to the GitHub API
response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
# If the request is successful, return the count of open issues
issues = response.json()
# Filter out PRs if needed
return len(issues)
else:
# If there's an error, print the status code and message
print(f"Error: {response.status_code}, {response.json()}")
return ""
open_issues_count = 0
page = 1

while True:
# Add pagination to the request
params['page'] = page
response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
issues = response.json()
if not issues:
# If no issues are returned, we've reached the last page
break
# Count open issues and exclude pull requests
open_issues_count += len([issue for issue in issues if 'pull_request' not in issue])
page += 1
else:
# If there's an error, print the status code and message
print(f"Error: {response.status_code}, {response.json()}")
return ""

return open_issues_count


def get_latest_releases(repo_name):
Expand Down

0 comments on commit e3c409d

Please sign in to comment.