Only execute GitlabCiService for push events.

This commit is contained in:
Douwe Maan 2015-02-24 14:29:21 +01:00
parent d86c0cda24
commit f13567edc4

View file

@ -22,8 +22,6 @@ class GitlabCiService < CiService
validates :project_url, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
delegate :execute, to: :service_hook, prefix: nil
after_save :compose_service_hook, if: :activated?
def compose_service_hook
@ -32,6 +30,13 @@ class GitlabCiService < CiService
hook.save
end
def execute(data)
object_kind = data[:object_kind]
return unless object_kind == "push"
service_hook.execute(data)
end
def commit_status_path(sha)
project_url + "/commits/#{sha}/status.json?token=#{token}"
end