Commit 80671bf7 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Separate the concern for executing hooks and updating states

parent 431792f7
......@@ -228,8 +228,18 @@ module Ci
end
def update_state
statuses.reload
last_status = status
if update_state_from_commit_statuses
execute_hooks if last_status != status && !skip_ci?
true
else
false
end
end
def update_state_from_commit_statuses
statuses.reload
self.status = if yaml_errors.blank?
statuses.latest.status || 'skipped'
else
......@@ -238,9 +248,7 @@ module Ci
self.started_at = statuses.started_at
self.finished_at = statuses.finished_at
self.duration = statuses.latest.duration
saved = save
execute_hooks if last_status != status && saved && !skip_ci?
saved
save
end
def execute_hooks
......
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