mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 12:45:46 +08:00
add: release use database data
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# repository_id :integer
|
||||
# sha :string(255)
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
@@ -29,4 +30,9 @@ class VersionRelease < ApplicationRecord
|
||||
has_many :project_trends, as: :trend, dependent: :destroy
|
||||
scope :releases_size, ->{where(draft: false, prerelease: false).size}
|
||||
has_many :attachments, as: :container, dependent: :destroy
|
||||
|
||||
def update_sha
|
||||
git_release = Gitea::Versions::GetService.call(user.gitea_token, repository&.owner&.login, repository&.identifier, version_gid)
|
||||
self.update(sha: git_release["sha"])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user