/
merge_request.rb
15 lines (15 loc) · 1.09 KB
/
merge_request.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# This class is used in TriggerControllerService::ScmExtractor to handle merge request events coming from Gitlab.
class GitlabPayload::MergeRequest < GitlabPayload
def payload
default_payload.merge(event: 'Merge Request Hook',
commit_sha: webhook_payload.dig(:object_attributes, :last_commit, :id),
pr_number: webhook_payload.dig(:object_attributes, :iid),
source_branch: webhook_payload.dig(:object_attributes, :source_branch),
target_branch: webhook_payload.dig(:object_attributes, :target_branch),
action: webhook_payload.dig(:object_attributes, :action),
project_id: webhook_payload.dig(:object_attributes, :source_project_id),
path_with_namespace: webhook_payload.dig(:project, :path_with_namespace),
target_repository_full_name: webhook_payload.dig(:project, :path_with_namespace),
source_repository_full_name: webhook_payload.dig(:source, :path_with_namespace))
end
end