Add .txt format support to changelog API

What does this MR do and why?

Every time I want to preview what the next release will include for my project I hit https://gitlab.com/api/v4/projects/56614952/repository/changelog?version=v999.999.999 and see something like:

{"notes":"## 999.999.999 (2026-05-22)\n\n### Maintenance (6 changes)\n\n- [Update dependency...

Then I have to copy/paste into VSCode, trim the JSON then find & replace \\n with \n to see the plain text.

This MR adds .txt format support to the changelog GET endpoint, using Grape built-in format routing (the same pattern used by the repository archive endpoint). Appending .txt to the URL returns the changelog as plain text Markdown instead of JSON.

GET /projects/:id/repository/changelog.txt?version=1.0.0

References

Similar pattern: Retrieve file archive from a repository uses [.format] suffix for response format control.

How to set up and validate locally

  1. Create a tag & release
  2. Push a commit with a changelog trailer like:
    Did a thing
    
    Changelog: Feature
  3. Hit http://gdk.test:3000/api/v4/projects/19/repository/changelog?version=v999.999.999 and see the JSON changelog
  4. Hit http://gdk.test:3000/api/v4/projects/19/repository/changelog.txt?version=v999.999.999 and see the plain text changelog

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.


🤖 This content was generated by GitLab Duo.

Edited by Lee Tickett

Merge request reports

Loading