Improve CI integration for merge requests
This commit is contained in:
parent
c92726e6c8
commit
ca936d2784
10 changed files with 83 additions and 12 deletions
|
@ -36,4 +36,22 @@ class GitlabCiService < Service
|
|||
def commit_badge_path sha
|
||||
project_url + "/status?sha=#{sha}"
|
||||
end
|
||||
|
||||
def commit_status_path sha
|
||||
project_url + "/builds/#{sha}/status.json?token=#{token}"
|
||||
end
|
||||
|
||||
def commit_status sha
|
||||
response = HTTParty.get(commit_status_path(sha))
|
||||
|
||||
if response.code == 200 and response["status"]
|
||||
response["status"]
|
||||
else
|
||||
:error
|
||||
end
|
||||
end
|
||||
|
||||
def build_page sha
|
||||
project_url + "/builds/#{sha}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -220,4 +220,8 @@ class MergeRequest < ActiveRecord::Base
|
|||
def to_patch
|
||||
project.repo.git.format_patch({timeout: 30, raise: true, stdout: true}, "#{target_branch}..#{source_branch}")
|
||||
end
|
||||
|
||||
def last_commit_short_sha
|
||||
@last_commit_short_sha ||= last_commit.sha[0..10]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue