修改同步的报错
This commit is contained in:
parent
e54780a9d9
commit
f9b871f039
|
@ -10,7 +10,7 @@ namespace :sync_forge_gitea do
|
||||||
all_repositories.find_each do |r|
|
all_repositories.find_each do |r|
|
||||||
project = r.project
|
project = r.project
|
||||||
user = project.owner
|
user = project.owner
|
||||||
unless r.url.to_s.include?("http://gitea.trustie.net")
|
unless r.url.to_s.include?("gitea.trustie.net")
|
||||||
if user && user.try(:gitea_token).present?
|
if user && user.try(:gitea_token).present?
|
||||||
repo_status = Gitea::Repository::GetService.new(user, r.identifier).call
|
repo_status = Gitea::Repository::GetService.new(user, r.identifier).call
|
||||||
if repo_status.present?
|
if repo_status.present?
|
||||||
|
@ -25,9 +25,12 @@ namespace :sync_forge_gitea do
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
gitea_repository = Gitea::Repository::CreateService.new(user.gitea_token, repository_params).call
|
gitea_repository = Gitea::Repository::CreateService.new(user.gitea_token, repository_params).call
|
||||||
r.update_attribute(:url, gitea_repository["clone_url"])
|
if gitea_repository
|
||||||
project.update_attributes(gpid: repo_status["id"],identifier: r.identifier)
|
r.update_attribute(:url, gitea_repository["clone_url"])
|
||||||
puts "__________after_create_gitea_repository_____#{gitea_repository}______"
|
project.update_attributes(gpid: repo_status["id"],identifier: r.identifier)
|
||||||
|
puts "__________after_create_gitea_repository_____#{gitea_repository}______"
|
||||||
|
end
|
||||||
|
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "_________create_gitea_git________file______error: #{e}"
|
puts "_________create_gitea_git________file______error: #{e}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue