Skip to content

Commit

Permalink
Merge pull request #3 from sunweaver/pr/silence-gitlab-list-warnings
Browse files Browse the repository at this point in the history
gitlab_release_notes/generate.py: Silence gitlab module warnings abou…
  • Loading branch information
vuillaut authored Oct 3, 2023
2 parents c416a05 + b1ad139 commit 80cb7b9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions gitlab_release_notes/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ def generate_release_notes(project_id, endstr = ' <br>', **config):
gl = gitlab.Gitlab(**config)
project = gl.projects.get(project_id)

if not project.mergerequests.list(state='merged'):
raise ValueError(f"There is not merged merge request for project {project_id} {project.name}")
if not project.mergerequests.list(get_all=False,state='merged'):
raise ValueError(f"There is no merged merge request for project {project_id} {project.name}")

if not project.releases.list():
if not project.releases.list(get_all=False):
log = f"Changelog of {project.name}:{endstr}"
last_date = '0000-01-01T00:00:00Z'
else:
last_release = project.releases.list()[0]
last_release = project.releases.list(get_all=False)[0]
log = f"Changelog since release {last_release.name} of {project.name}:{endstr}"
last_date = last_release.released_at

page = 1
list_mrs = project.mergerequests.list(state='merged',
get_all=False,
order_by='updated_at',
updated_after=last_date,
page=page)
Expand All @@ -59,6 +60,7 @@ def generate_release_notes(project_id, endstr = ' <br>', **config):

page += 1
list_mrs = project.mergerequests.list(state='merged',
get_all=False,
order_by='updated_at',
updated_after=last_date,
page=page
Expand Down

0 comments on commit 80cb7b9

Please sign in to comment.