Integrate data about Git development into contributors-gitlab-com
With some recent changes, the Git team scripts can now generate events in the form of timestamped JSON data (representing patches, reviews, merges, etc.).
We propose feeding this JSON data into contributors-gitlab-com to track and reward contributions to the Git project alongside GitLab.
The Plan
1. Database Schema
Since Git activities (emails, commits) don't fit perfectly into the existing merge_requests or issues tables, we should create a flexible git_activities table to store these external events. For example:
create_table :git_activities do |t|
t.references :user # Links to the existing GitLab user
t.string :activity_type # "git_patch", "git_review", "git_commit_merged", ...
t.string :external_id # Commit hash or email Message-ID
t.string :url # Link to git.kernel.org or lore.kernel.org
t.datetime :occurred_at # Email or commit timestamp
t.text :metadata # (Optional) Subject / summary, etc.
t.timestamps
end
2. Backend Importer
Implement app/services/git_importer_service.rb. This service will:
- Read the incoming JSON stream.
- Find the corresponding GitLab user by email.
- Create records in
git_activitiesin an idempotent way. - Trigger the gamification engine to award points.
3. Categorization Logic
To integrate these new types into the existing leaderboard filters without polluting the "GitLab" view, we can introduce a categorization constant in the Activity model:
CATEGORIES = {
# --- GITLAB ---
'merge_request_merged' => :gitlab_dev,
'merge_request_created'=> :gitlab_dev,
'issue_opened' => :gitlab_dev,
'issue_note' => :gitlab_comm,
'discourse_post' => :gitlab_comm,
'discord_message' => :gitlab_comm,
# --- GIT CORE ---
'git_patch' => :git_dev,
'git_review' => :git_dev,
'git_commit_merged' => :git_dev,
'git_bug' => :git_dev,
'git_question' => :git_comm,
'git_discussion' => :git_comm,
'git_announce' => :git_comm
}.freeze
4. Frontend Changes
Update the Dashboard to support a "Category Filter" or "Context Switcher" to view results in different slices:
- "GitLab (All)" → queries :gitlab_dev + :gitlab_comm,
- "Git (All)" → queries :git_dev + :git_comm,
- "Development (Global)" → queries :gitlab_dev + :git_dev,
- etc
Open Questions / Points Strategy
We need to determine point values. A suggested starting point to align with GitLab contributions:
- Patch / Merged Commit: Equivalent to a Merged MR (High Value).
- Review / Bug Report: Equivalent to an Issue or Comment (Medium Value).
- Discussion: Equivalent to a Forum Post (Community Value).
This is related to: https://gitlab.com/gitlab-com/gitlab-OKRs/-/work_items/10810