Commit f13567ed authored by Douwe Maan's avatar Douwe Maan

Only execute GitlabCiService for push events.

parent d86c0cda
...@@ -22,8 +22,6 @@ class GitlabCiService < CiService ...@@ -22,8 +22,6 @@ class GitlabCiService < CiService
validates :project_url, presence: true, if: :activated? validates :project_url, presence: true, if: :activated?
validates :token, presence: true, if: :activated? validates :token, presence: true, if: :activated?
delegate :execute, to: :service_hook, prefix: nil
after_save :compose_service_hook, if: :activated? after_save :compose_service_hook, if: :activated?
def compose_service_hook def compose_service_hook
...@@ -32,6 +30,13 @@ class GitlabCiService < CiService ...@@ -32,6 +30,13 @@ class GitlabCiService < CiService
hook.save hook.save
end end
def execute(data)
object_kind = data[:object_kind]
return unless object_kind == "push"
service_hook.execute(data)
end
def commit_status_path(sha) def commit_status_path(sha)
project_url + "/commits/#{sha}/status.json?token=#{token}" project_url + "/commits/#{sha}/status.json?token=#{token}"
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment