Skip to content
Cyril Moreau edited this page May 22, 2025 · 12 revisions

This page contains the details concerning the creation of the Activity Mapping for GitLab. This activity mapping is an adaptation of ghmap which is designed for GitHub.

This mapping aims to transform raw events from the GitLab API into a structured format that represents the activities of a user on GitLab. This mapping works as :

  1. Event-to-Action Mapping: Maps raw events to a set of actions. This mapping is defined in a json file.
  2. Action-to-Activity Mapping: Groups consecutive actions from the same repository into activities. This mapping is also defined in a json file.

For this project, we created two new json files: gl_event_to_action.json and gl_action_to_activity.json to adapt the mapping to GitLab.

Moreover, ghmap code was modified to depend mostly on the json config files. This way, the mapping can be easily adapted to other platforms only by changing the json files. The modified code can be found here.

GitLab Activity Mapping

Documentation:

To detect the actions, 3 important fields of the raw events are used:

  • action_name: What the user did. (Ex: opened, closed, created, ...)
  • target_type: On what the action was executed. (Ex: Issue, PullRequest, ...)
  • created_at: When the action was done. Format: ISO 8601 with milliseconds. (Ex: 2017-02-09T10:43:19.667Z)

The mapping of each action and activity for each object type (e.g., Issue, PullRequest) is detailed on a dedicated page for each object. See all object mappings here.

Goal of the Mapping

Overall, the idea is to define an activity as something that corresponds to a user action / a “click”. For example, when a user merges a pull request, they click the "Merge" button, and several actions are automatically triggered by GitLab, such as closing an issue, deleting the branch, etc. The goal is to group these resulting actions into a single activity to better represent the user's behavior.

However, some activities can be very repetitive and closely related. For instance, a user might comment multiple times on a pull request. In this case, we consider that the user is performing only one activity: CommentPullRequest. This grouping makes sense because the user's focus remains on the same task, and the context doesn't significantly change between individual comments—there’s minimal context switching involved.

Limitations

While our approach aims to provide an accurate representation of user activity, there are some inherent limitations caused by the way GitLab records and exposes events:

  • Missing Events: Certain actions, such as forking a repository (ForkRepo) or publishing a release (PublishRelease), do not generate any events in the GitLab API but are generated by the GitHub API. As a result, these activities cannot be detected.
    This is particularly problematic in cases where bots are specifically designed to manage releases—for instance, by automatically publishing new versions—since their behavior would go unnoticed, leading to an incomplete analysis of their activity.
  • Ambiguous Events: Some events lack sufficient information to destinguish between similar but distinct actions. For example, when a user reopens an issue or a merge request, GitLab generates the same event type as when it is opened for the first time. This makes impossible to differentiate between an open and a reopen activity.

These limitations can lead to incomplete or imprecise representations of user activity. However, we believe that the overall mapping still provides valuable insights into user behavior on GitLab.

Comparison with GitHub Activity Mapping

The following table show the activities in common between GitHub and GitLab with their corresponding actions. Rep means that the action can be repeated and Opt means that the action is optional.

Activities (common) Actions GitLab Actions GitHub
ManageWikiPages - CreateWikiPage - Opt - Rep
- DestroyWikiPage - Opt - Rep
- UpdateWikiPage - Opt - Rep
- ManageWikiPage - Rep
MergePullRequest - MergePullRequest
- PushCommits - Opt
- DeleteBranch - Opt
- CloseIssue - Opt - Rep
- MergePullRequest
- PushCommits - Opt
- DeleteBranch - Opt
- CloseIssue - Opt - Rep
CreateRepository - CreateRepository
- CreateBranch - Opt
- CreateRepository
- CreateBranch - Opt
ManageBranches - CreateBranch - Opt - Rep
- DeleteBranch - Opt - Rep
- CreateBranch - Opt - Rep
- DeleteBranch - Opt - Rep
ManageTags - CreateTag - Opt - Rep
- DeleteTag - Opt - Rep
- CreateTag - Opt - Rep
- DeleteTag - Opt - Rep
CommentCommits - CreateCommitComment - Opt - Rep
- CreateCommitThread - Opt - Rep
- CreateCommitReviewComment - Opt - Rep
- CommentCommits - Rep
OpenIssue - OpenIssue
- CreateIssueComment - Opt
- CreateIssueThread - Opt
- OpenIssue
CloseIssue - CloseIssue
- CreateIssueComment - opt
- CreateIssueThread - Opt
- CloseIssue
- CreateIssueComment - opt
OpenPullRequest - OpenPullRequest
- CreatePullRequestComment - Opt
- CreatePullRequestThread - opt
- OpenPullRequest
ClosePullRequest - ClosePullRequest
- CreatePullRequestComment - Opt
- CreatePullRequestThread - Opt
- ClosePullRequest
- CreatePullRequestComment - Opt
CommentIssue -CreateIssueComment - Opt - Rep
-CreateIssueThread - Opt - Rep
- CreateIssueComment - Rep
CommentPullRequest -CreatePullRequestComment - Opt - Rep
-CreatePullRequestThread - Opt - Rep
- CreatePullRequestComment - Rep
PushCommits -PushCommits - Rep - PushCommits - Rep
ReviewPullRequest - ApprovePullRequest - Opt
- CreatePullRequestReviewComment - Opt - Rep
- CreatePullRequestThread - opt-Rep
- CreatePullRequestReview - Opt - Rep
- CreatePullRequestReviewComment - Opt - Rep

Obviously, some activites can be detected only on one platform. For example, StarRepository is only available on GitHub. The following tables show the activities that are specific to GitLab and GitHub.

Activities (GitLab only) Actions GitLab
UpdateRepositoryMembership - JoinRepository - opt
- LeftRepository - opt
- ExpireRepositoryMembership - opt
ImportRepositories - ImportRepository - Rep
ManageDesigns - AddDesign-Opt-Rep
- UpdateDesign-Opt-Rep
- RemoveDesign-Opt-Rep
CommentDesign - CreateDesignComment - Rep
ManageMilestones - CreateMilestone - Opt - Rep
- CloseMilestone - Opt - Rep
- DestroyMilestone - Opt - Rep
CommentSnippet - CreateSnippetComment - Opt - Rep
- CreateSnippetThread - Opt - Rep
CreateWorkItem - CreateWorkItem
- CreateIssueComment - Opt
CloseWorkItem - CloseWorkItem
- CreateIssueComment - Opt
CommentWikiPages - CreateWikiPageComment - Rep
Activities (GitHub only) Actions GitHub
MakeRepositoryPublic - MakeRepositoryPublic
AddContributors - AddMember - Rep
PublishRelease - PublishRelease
- CreateTag - Opt
ForkRepository - ForkRepository
ReopenIssue - ReopenIssue
- CreateIssueComment - Opt
ReopenPullRequest - ReopenPullRequest
- CreatePullRequestComment - Opt
StarRepository - StarRepository

Links to Object Mappings

Clone this wiki locally