Skip to content

glmap: Commits

Cyril Moreau edited this page Jun 2, 2025 · 6 revisions

Commmits works the same way as GitHub Commits.

It works the same way as GitHub Commits but GitLab has a specific event for starting a conversation on a list of code of a commit: CreateCommitReviewComment.

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

Action target_type action détection
PushCommits null pushed to push_data.action = pushed
CreateCommitReviewComment DiffNote commented on note.noteable_type = Commit
CreateCommitComment Note commented on note.noteable_type = Commit
CreateCommitThread DiscussionNote commented on note.noteable_type = Commit
Activity Actions time window
CommentCommits - CreateCommitComment - Opt - Rep
- CreateCommitThread - Opt - Rep
- CreateCommitReviewComment - Opt - Rep
300s
PushCommits PushCommits - Rep 2s

1 - Actions

  • Detection are the values used to detect what action has been performed.
  • Details are information found in the payload of the event that can be used to group actions to activities. (name_in_action = name_in_payload)

1.1 - PushCommits

Triggered when commits are pushed to a repository. Multiple commits can be pushed at the same time and the number of commits will be stored in push_data.total_commits_count.

Detection:

  • action_name = pushed to
  • target_type = null
  • push_data.action = pushed

Details:

  • commit.id = push_data.commit_to
  • commit.title = push_data.commit_title
  • commit.count = push_data.commit_count
  • branch.name = push_data.ref

1.2 - CreateCommitReviewComment

Triggered when a conversation (thread) is started on a part of the code of a commit. This event is not part of the regular review process which has a specific event for that.

Detection:

  • action_name = commented on
  • target_type = DiffNote
  • note.noteable_type = Commit

Details:

  • commit.title = target_title
  • review.file = note.position.new_path
  • review.line = note.position.new_line
  • commit_review_comment.id = note.id
  • commit_review_comment.body = note.body

1.3 - CreateCommitComment

Triggered when a comment is made on a commit.

Detection:

  • action_name = commented on
  • target_type = Note
  • note.noteable_type = Commit

Details:

  • commit.title = target_title
  • commit_comment.id = note.id
  • commit_comment.body = note.body

1.4 - CreateCommitThread

Triggered when a conversation (thread) is started on a commit.

Detection:

  • action_name = commented on
  • target_type = DiscussionNote
  • note.noteable_type = Commit

Details:

  • commit.title = target_title
  • commit_comment.id = note.id
  • commit_comment.body = note.body

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 - CommentCommits

time window: 300s

Based on ghmap, we will group all comments made on the commits of the same repository.

Actions:

  • CreateCommitComment - optional - repeatable
  • CreateCommitThread - optional - repeatable
  • CreateCommitReviewComment - optional - repeatable

2.2 - PushCommits

time window: 2s

Based on ghmap, we will also group all pushes made consecutively in the same repository.

The use of the command "git push" generates only one action even if multiple commits are pushed at the same time. Grouping with a time window of 2 seconds ensures that we will group pushes made consecutively.

Actions:

  • PushCommits - mandatory - repeatable

Clone this wiki locally