Skip to content
Snippets Groups Projects
Commit 07f7ba18 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Update file script.py

parent d463fcc3
No related branches found
No related tags found
No related merge requests found
......@@ -78,8 +78,16 @@ def get_total_commits_last_month(gl):
total_commits_last_month = 0
projects = gl.projects.list(all=True)
for project in projects:
commits = project.commits.list(since=last_month_start, until=last_month_end)
total_commits_last_month += len(commits)
try:
commits = project.commits.list(since=last_month_start, until=last_month_end)
total_commits_last_month += len(commits)
except gitlab.exceptions.GitlabHttpError as e:
if e.response_code == 404:
# Repository not found for the project
print(f"Warning: Repository not found for project '{project.name}'")
else:
# Other GitLab API error
print(f"Error: GitLab API error for project '{project.name}': {e}")
return total_commits_last_month
......@@ -113,7 +121,7 @@ def get_gitlab_info(api_token):
print("Auth successful")
# Get the number of projects
projects = gl.projects.list()
projects = gl.projects.list(all=True)
num_projects = len(projects)
print(f"Number of projects: {num_projects}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment