Merge branch 'standalone_develop' of https://gitlink.org.cn/Trustie/forgeplus into standalone_develop

This commit is contained in:
yystopf 2024-05-15 15:00:25 +08:00
commit e9587ff322
1 changed files with 7 additions and 7 deletions

View File

@ -8,7 +8,7 @@ class Api::V1::Projects::SyncRepositories::CreateService < ApplicationService
validates :type, inclusion: {in: %w(SyncRepositories::Gitee SyncRepositories::Github)} validates :type, inclusion: {in: %w(SyncRepositories::Gitee SyncRepositories::Github)}
validates :external_repo_address, format: { with: CustomRegexp::URL_REGEX, multiline: true, message: "地址格式不正确" } validates :external_repo_address, format: { with: CustomRegexp::URL_REGEX, multiline: true, message: "地址格式不正确" }
validates :sync_granularity, :first_sync_direction, inclusion: {in: [1,2]} validates :sync_granularity, :first_sync_direction, inclusion: {in: [1,2]}
validate :check_gitlink_branch_name # validate :check_gitlink_branch_name
def initialize(project, params) def initialize(project, params)
@project = project @project = project
@ -40,12 +40,12 @@ class Api::V1::Projects::SyncRepositories::CreateService < ApplicationService
[@sync_repository1, @sync_repository2, @sync_repository_branch1, @sync_repository_branch2] [@sync_repository1, @sync_repository2, @sync_repository_branch1, @sync_repository_branch2]
end end
def check_gitlink_branch_name # def check_gitlink_branch_name
if sync_granularity == 2 # if sync_granularity == 2
result = $gitea_hat_client.get_repos_branch_name_set_by_owner_repo(project&.owner&.login, project&.identifier) rescue nil # result = $gitea_hat_client.get_repos_branch_name_set_by_owner_repo(project&.owner&.login, project&.identifier) rescue nil
raise Error, '分支不存在' if !result.include?(gitlink_branch_name) # raise Error, '分支不存在' if !result.include?(gitlink_branch_name)
end # end
end # end
private private
def create_sync_repository def create_sync_repository