From cabc9775bc89473b59a4e5590cffa6515bc2c5bc Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 2 Jul 2025 14:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=A1=B9=E7=9B=AE=E5=A4=B1=E8=B4=A5=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v1/organizations/sync_repositories_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/api/v1/organizations/sync_repositories_controller.rb b/app/controllers/api/v1/organizations/sync_repositories_controller.rb index 9a4d7e077..d02dcd40c 100644 --- a/app/controllers/api/v1/organizations/sync_repositories_controller.rb +++ b/app/controllers/api/v1/organizations/sync_repositories_controller.rb @@ -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