Skip to content

Provide information about first contribution in API

This is raised in https://gitlab.com/gitlab-org/quality/team-tasks/issues/46#note_108148602 where we want to add gitlab-ce~8745578 automatically via triage-ops.

We can do it if the API querying the merge requests could provide this information. A rough idea implementing this is:

diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 32f9bb4d448..526fdcf96cb 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -623,6 +623,7 @@ module API
         merge_request.labels.map(&:title).sort
       end
       expose :work_in_progress?, as: :work_in_progress
+      expose :first_contribution?, as: :first_contribution
       expose :milestone, using: Entities::Milestone
       expose :merge_when_pipeline_succeeds

And so we could add this to triage-ops:

- name: Label community merge requests
  conditions:
    author_member:
      source: group
      condition: not_member_of
      source_id: gitlab-org
    labels:
      - No Label
    state: opened
  actions:
    labels:
      - Community contribution
    comment: |
      #{'/label ~"1st contribution"' if resource[:first_contribution]}