Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-report
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tools
gitlab-report
Commits
07f7ba18
Commit
07f7ba18
authored
1 year ago
by
Sigmund, Dominik
Browse files
Options
Downloads
Patches
Plain Diff
Update file script.py
parent
d463fcc3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
script.py
+11
-3
11 additions, 3 deletions
script.py
with
11 additions
and
3 deletions
script.py
+
11
−
3
View file @
07f7ba18
...
...
@@ -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
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment