From 14cb3eb2dd3f24ee28f8a580414a8cd38bc154aa Mon Sep 17 00:00:00 2001 From: Wedge Date: Tue, 30 Oct 2018 11:03:28 +0300 Subject: [PATCH] Fix increase release tag(new api change it seems) --- app/models/project.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index a6de1662a..04fa457d2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -214,14 +214,25 @@ 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