Skip to content

glmap: Repositories

Cyril Moreau (cymo) edited this page Mar 19, 2025 · 3 revisions

In GitLab, a repository is composed of the Git part of a Project (code + commit history), but we will use the term repository instead of Project in this document to be consistent with the GitHub documentation. For more information on GitLab projects, see the GitLab documentation.

Compared to GitHub, GitLab API does not return any events like MakeRepoPublic or AddMember. However, it returns events if a User join or leave a repository. (e.g. JoinRepository, ExpireRepositoryMembership)

The following table shows the mapping of the events generated by GitLab for Repositories. A fully detailed mapping can be found below.

Action target_type action
CreateRepository null created
JoinRepository null joined
ExpireRepositoryMembership null removed due to membership expiration from
LeftRepository null left
ImportRepository null imported
Activity Actions time window
CreateRepository - CreateRepository
- CreateBranch - Opt
3s
UpdateRepositoryMembership - JoinRepository - opt
- LeftRepository - opt
- ExpireRepositoryMembership - opt
0s
ImportRepositories - ImportRepository - Rep 3600s

1 - Actions

  • Detection are the values used to detect what action has been performed.
  • In this case, no more information is available in the payload of the event.

1.1 - CreateRepository

Detection:

  • action_name = created
  • target_type = null

1.2 - JoinRepository

The event is triggered when a user joins a repository, so when he is invited to the repository.

Detection:

  • action_name = joined
  • target_type = null

1.3 - ExpireRepositoryMembership

In GitLab, we can set a limit to the membership of a user in a repository. When this limit is reached, the user is removed from the repository. So, this is not an action performed directly by the user.

Detection:

  • action_name = "removed due to membership expiration from"
  • target_type = null

1.4 - LeftRepository

This event is triggered when a user leaves or is removed from a repository.

Detection:

  • action_name = left
  • target_type = null

1.5 - ImportRepository

In GitLab, we can import a repository from another platform. This event is triggered when a repository is imported. (Doc)

Detection:

  • action_name = imported
  • target_type = null

2 - Activities

Each activity is composed of one or more actions. Each action can be repeatable and can be optional. A maximum time window is also defined for each activity and it is used to group actions that are close to each other in time.

For each action, we can define a verification function (validate_with) to make sure that the action is part of the activity. (e.g comments are made on the same issue)

2.1 - CreateRepository

time window = 3s (Based on ghmap)

We can create a repository without initializing it with a README. In this case, we don't have any branch created.

In ghmap, we could validate that the created branch was the main branch. However, in GitLab, we don't have enough information to do that because we don't have the name of the branch in the payload of the CreateRepository event.
(We could do it if we could validate with an hardcoded value in ghmap)

Actions:

  • CreateRepository - mandatory - non repeatable
  • CreateBranch - optional - non repeatable

2.2 - UpdateRepositoryMembership

time window = 0s

Since ghmap groups actions that are on coming from the same repository, we could not have multiple actions for this activity. This is why the time window is set to 0s.

Actions:

  • JoinRepository - optional - non repeatable
  • LeftRepository - optional - non repeatable
  • ExpireRepositoryMembership - optional - non repeatable

2.3 - ImportRepositories

time window = 3600s

importRepository is the only action generated by this activity. However, we decided to set a time window of 3600s to group all the consecutive imports of repositories with the idea that if a user switch from one platform to another, he may import all his repositories at the same time.

Actions:

  • ImportRepository - mandatory - repeatable

Clone this wiki locally