Changelog generator API always return "No Changes"

Hi there, when running the Changelog generator API (e.g. https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog), I seem to always get “No Changes” no matter what I try, did I do something wrong?

Setup:

  • The repo have tags in X.Y.Z format as specified, the latest tag was 0.4.6
  • .gitlab/changelog_config.yml file is in place
  • There are several new commits in master since 0.4.6
  • Tried the API withg GET method (see below)
  • Tried actual POST method
  • Tried on a diff repo without the changelog config

Results:

  • The rules defined in changelog_config.yml are not followed at all
  • None of the GET curl commands work, all would return “no changes”
  • The POST methods did not work either, also return “no changes”
  • The API call did not work on other repos either

Subset of the commands I tried
curl --header "PRIVATE-TOKEN:TOKEN" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=0.4.6"
curl --header "PRIVATE-TOKEN:TOKEN" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=0.4.7"
curl --header "PRIVATE-TOKEN:TOKEN" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=1.0.0"

curl --header "PRIVATE-TOKEN:TOKEN" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=0.4.7&branch=master"
curl --header "PRIVATE-TOKEN:TOKEN" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=0.4.7&from=PREVIOUS_COMMITSHA&to=LATEST_COMMIT_SHA"
curl --header "PRIVATE-TOKEN:TOKEN" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=0.4.7&from=PREVIOUS_COMMITSHA&to=LATEST_COMMIT_SHA&branch=master"

I found the solution to my issue, it turns out we have to use --trailer feature, which is actually mentioned in the doc, but not included in any examples.

Here’s one basic way to concept-proof this from start to finish:

  1. make code changes
  2. make sure tags follow the X.Y.Z format
  3. config template to read feature (or whatever string you define) as a category as shown in doc here
  4. IMPORTANT: commit changes with trailer git commit -m "message to appear in changelog" --trailer "Changelog: feature"
  5. run the changelog API like so: curl --header "PRIVATE-TOKEN:[TOKEN]" "https://gitlab.com/api/v4/projects/[PROJ_ID]/repository/changelog?version=[LATEST_VERSION]"