更改:导入同步项目失败处理

This commit is contained in:
yystopf 2025-07-02 14:56:27 +08:00
parent 8c9f6d6175
commit cabc9775bc
1 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,11 @@ class Api::V1::Organizations::SyncRepositoriesController < Api::V1::BaseControll
# 检查是否已经存在该仓库
@project = @organization.projects.find_by(identifier: repo["name"])
if @project.present?
if @project.repository.mirror.failed?
@project.destroy!
mirror_params = {name: repo["name"], user_id: @organization.id, description: repo["description"], repository_name: repo["name"], auth_token: params[:external_token], clone_addr: repo["clone_url"]}
@project = ::Projects::MigrateService.call(current_user, mirror_params)
end
@project.update_column(:created_on, repo['created_at'].to_time)
@project.update_column(:updated_on, repo['updated_at'].to_time)
next