fixed 发行版git删除时,不同步处理

This commit is contained in:
“xxq250” 2022-08-16 14:03:05 +08:00
parent 25fa6f427b
commit 98f1723411
1 changed files with 2 additions and 1 deletions

View File

@ -32,7 +32,8 @@ class VersionRelease < ApplicationRecord
has_many :attachments, as: :container, dependent: :destroy has_many :attachments, as: :container, dependent: :destroy
def update_sha def update_sha
return if version_gid.blank?
git_release = Gitea::Versions::GetService.call(user.gitea_token, repository&.owner&.login, repository&.identifier, version_gid) git_release = Gitea::Versions::GetService.call(user.gitea_token, repository&.owner&.login, repository&.identifier, version_gid)
self.update(sha: git_release["sha"]) self.update(sha: git_release["sha"]) if git_release.present? && git_release.is_a?(Hash)
end end
end end