How to use git trailers in gitlab.com open source projects?

,

How to use git trailers in gitlab.com projects ?

Hello,

I was wondering if anyone had managed to use git trailers to generate changelogs in gitlab projects ?

I found that gitlab is able to us it on their repo, but couldn’t find documentation on how to set it up

It’s described here: Repositories API | GitLab

If your commits use the Changelog trailer, you can use that API endpoint to generate changelog. The POST endpoint will commit the changes to the changelog file automatically, while the GET one will allow you to fetch or preview the new changelog.

1 Like

Thanks for your answer. Is there an easy way to do so directly from the gitlab ci ?

It shouldn’t be too hard, but I haven’t done that, so I’m not sure. Depends on your workflow.

I’d try just calling curl --request POST --header "PRIVATE-TOKEN: <token>" --data "version=<tag>" "https://gitlab.com/api/v4/projects/<your project id>/repository/changelog" in CI job triggered by new tag, I’d use tag name as a version (assuming here that your tags follow semver).