mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-24 05:35:46 +08:00
新增:绑定仓库和webhook触发地址
This commit is contained in:
24
app/jobs/touch_sync_job.rb
Normal file
24
app/jobs/touch_sync_job.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class TouchSyncJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(touchable)
|
||||
puts "aaaa"
|
||||
case touchable.class.to_s
|
||||
when 'SyncRepositories::Github' || 'SyncRepositories::Gitee'
|
||||
Reposync::SyncRepoService.call(touchable.repo_name)
|
||||
when 'SyncRepositoryBranch'
|
||||
sync_repository = touchable.sync_repository
|
||||
result = []
|
||||
if sync_repository.sync_direction == 1
|
||||
result = Reposync::SyncBranchService.call(sync_repository.repo_name, touchable.gitlink_branch_name, sync_repository.sync_direction)
|
||||
else
|
||||
result = Reposync::SyncBranchService.call(sync_repository.repo_name, touchable.external_branch_name, sync_repository.sync_direction)
|
||||
end
|
||||
if result.is_a?(Array)
|
||||
touchable.update_column(:sync_status, 1)
|
||||
else
|
||||
touchable.update_column(:sync_status, 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user