Skip to content

Draft: Add a with_tags parameter to the commits api endpoint

Jerry Seto requested to merge 18795-commits-api-with-tags into master

What does this MR do and why?

Add a with_tags parameter to include tags in the commits endpoint response in order to support showing tags on the commits view

How to set up and validate locally

Example curl:

curl 'localhost:3000/api/v4/projects/1/repository/commits?private_token=PRIVATE_TOKEN&with_tags=true'

Example element from response:

{
      "author_email" : "email@example.com",
      "author_name" : "Someone",
      "authored_date" : "2014-02-27T10:54:21.000+02:00",
      "committed_date" : "2014-02-27T10:54:21.000+02:00",
      "committer_email" : "email@example.com",
      "committer_name" : "Someone",
      "created_at" : "2014-02-27T10:54:21.000+02:00",
      "id" : "6f6d7e7ed87bb5f0054f2b1df789b39ca89b6ff9",
      "message" : "Stuff",
      "parent_ids" : [
         "d14d6c0abdd252381df51a723d58691b2ee1ab08"
      ],
      "short_id" : "6f6d7e7e",
      "tags" : [
         "refs/tags/v1.0.0"
      ],
      "title" : "Things",
      "trailers" : {},
      "web_url" : "http://127.0.0.1:3000/root/project_name/-/commit/6f6d7e7ed87bb5f0054f2b1df789b39ca89b6ff9"
   }

Tag badges should appear on the commits page

Screenshot_2023-01-05_at_4.17.26_PM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #18795 (closed)

Edited by Jerry Seto

Merge request reports

Loading