Fix increase release tag(new api change it seems)

This commit is contained in:
Wedge 2018-10-30 11:03:28 +03:00
parent 57cd131f38
commit 14cb3eb2dd
1 changed files with 14 additions and 3 deletions

View File

@ -214,15 +214,26 @@ class Project < ActiveRecord::Base
end
def increase_release_tag(project_version, message)
file = Github_blobs_api.contents github_get_organization + '/' + name, path: '/' + name + '.spec', ref: project_version rescue nil
begin
file = Github_blobs_api.contents github_get_organization + '/' + name, path: '/' + name + '.spec', ref: project_version
rescue => e
Raven.capture_exception(e)
return false
end
if file
decoded_content = Base64.decode64(file.content)
new_content = Project.replace_release_tag decoded_content
return if new_content == decoded_content
Github_blobs_api.update_contents github_get_organization + '/' + name, '/' + name + '.spec',\
message, file.sha, new_content, branch: project_version rescue nil
begin
Github_blobs_api.update_contents github_get_organization + '/' + name, name + '.spec',\
message, file.sha, new_content, branch: project_version
rescue => e
Raven.capture_message(e)
return false
end
end
return true
end
protected