更改:fork项目为子项目下的fork项目

This commit is contained in:
yystopf 2023-03-23 09:49:35 +08:00
parent ee50083a57
commit e0692bd92a
1 changed files with 9 additions and 8 deletions

View File

@ -23,15 +23,16 @@ namespace :special_commit do
next if sub_owner.nil? || sub_project.nil? next if sub_owner.nil? || sub_project.nil?
sub_commit_list_result = $gitea_client.get_repos_commits_by_owner_repo(sub_project_owner_login, sub_project_identifier) sub_commit_list_result = $gitea_client.get_repos_commits_by_owner_repo(sub_project_owner_login, sub_project_identifier)
total_commits += sub_commit_list_result[:total_data].to_i total_commits += sub_commit_list_result[:total_data].to_i
end puts "====Sync Count Project Submodule forkproject Commit===="
puts "====Sync Count Project forkproject Commit====" sub_project.forked_projects.each do |p|
project.forked_projects.each do |p|
forked_project_owner_login = p.owner&.login forked_project_owner_login = p.owner&.login
forked_project_identifier = p.identifier forked_project_identifier = p.identifier
next if forked_project_owner_login.nil? || forked_project_owner_login.nil? next if forked_project_owner_login.nil? || forked_project_owner_login.nil?
forked_commit_list_result = $gitea_client.get_repos_commits_by_owner_repo(forked_project_owner_login, forked_project_identifier) forked_commit_list_result = $gitea_client.get_repos_commits_by_owner_repo(forked_project_owner_login, forked_project_identifier)
total_commits += forked_commit_list_result[:total_data].to_i total_commits += forked_commit_list_result[:total_data].to_i
end end
end
puts "====Write total commits to cache====" puts "====Write total commits to cache===="
$redis_cache.set("ProjectSpecialCommit:#{project.id}", total_commits) $redis_cache.set("ProjectSpecialCommit:#{project.id}", total_commits)
$redis_cache.expireat("ProjectSpecialCommit:#{project.id}", (Date.today+30.days).to_time.to_i) $redis_cache.expireat("ProjectSpecialCommit:#{project.id}", (Date.today+30.days).to_time.to_i)