Skip to content

Include labels details in Issues API

This is inspired from gitlab-org/quality/triage-ops#7 (comment 98724284) where we're trying to make gitlab-triage act based on when auto updated label was added.

For now, the issues API will only return a list of label names. In order to keep backward compatibility, we could extend that only when we're passing labels_detail=true, or we could simply add another exposure like labels_detail containing the details. Of course this could be optional, too, since I would expect to have data from label_links, which means we need to preload that table, too.

I wish the API could give me something like this:

{
  "labels": [
    {
      "name": "auto updated",
      "id": 123,
      "group_id": 456, // or "project_id" if the label was a project label
      "added_at": "2018-09-04T10:04:34+00:00", // This is label_links.created_at for the corresponding relation
      "added_by": // Don't see we could include this easily, but it would be nice to have it
        {
          "username": "gitlab-bot",
          "id": 789
        }
    {
  ]
}

This will be very powerful to build automatic triaging. We might need to add a lot of different labels for different rules though. We're already abusing it a lot so I think it's fine to abuse more as long as we have more tools building on top of it.

@victorwu @smcgivern What do you think?

/cc @markglenfletcher