Skip to content

Cannot create changelog with changelog-API when release starts with a v

Summary

When I want to create a new changelog with the changelog-API, it only works with tags like 1.0.0, not with v1.0.0.

Steps to reproduce

  1. in an existing repo with commits, create a new tag containing a v and push it
> git tag v1.0.6
> git push origin v1.0.6
  1. try to use the changelog API to create a changelog with v1.0.7:
> glab api /projects/:id/repository/changelog?version=v1.0.7
{
  "message": "Failed to generate the changelog: The commit start range is unspecified, and no previous tag could be found to use instead"
}
  1. Doing so without the v works:
> glab api /projects/:id/repository/changelog?version=1.0.7
{
  "notes": "## 1.0.7 (2024-01-08)\n\nNo changes.\n"
}

Example Project

https://gitlab.com/rndmh3ro/test-project-changelog-api

What is the current bug behavior?

The changelog generation fails.

What is the expected correct behavior?

The changelog generation succeeds.

Output of checks

This bug happens on GitLab.com

Possible fixes

The problems probably comes from here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/repositories/changelog_service.rb?ref_type=heads#L128

The relevant regex is probably this one: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/changelog/config.rb?ref_type=heads#L31