|
|
|
@ -220,6 +220,16 @@ class ShixunsController < ApplicationController
|
|
|
|
|
evaluate_script: @shixun.evaluate_script)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 同步私密版本库
|
|
|
|
|
if @shixun.shixun_secret_repository
|
|
|
|
|
repo_name = "#{current_user.login}/secret_#{@shixun.identifier}"
|
|
|
|
|
fork_repository_name = "#{current_user.login}/secret_#{@new_shixun.identifier}"
|
|
|
|
|
ShixunSecretRepository.create!(shixun_id: @new_shixun.id,
|
|
|
|
|
repo_name: "#{repo_name}",
|
|
|
|
|
secret_dir_path: @shixun.shixun_secret_repository.secret_dir_path)
|
|
|
|
|
GitService.fork_repository(repo_path: "#{repo_name}.git", fork_repository_path: (fork_repository_name + ".git"))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 同步镜像
|
|
|
|
|
if @shixun.mirror_repositories.present?
|
|
|
|
|
@shixun.mirror_repositories.each do |mirror|
|
|
|
|
@ -479,6 +489,7 @@ class ShixunsController < ApplicationController
|
|
|
|
|
else
|
|
|
|
|
# 如果有仓库,就要删
|
|
|
|
|
if @shixun.shixun_secret_repository&.repo_name
|
|
|
|
|
@shixun.shixun_secret_repository.lock!
|
|
|
|
|
GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path)
|
|
|
|
|
@shixun.shixun_secret_repository.destroy
|
|
|
|
|
end
|
|
|
|
|