From 7b1b03ab41f3e59695e4dad34b12b3f85207ab6d Mon Sep 17 00:00:00 2001 From: zhangxunhui Date: Fri, 3 Feb 2023 13:19:27 +0800 Subject: [PATCH] change push_activity_2_blockchain by querying projects with identifier --- app/controllers/application_controller.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0efbd8900..d9c08aada 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1378,7 +1378,8 @@ class ApplicationController < ActionController::Base end pull_request_id = model['id'] - reponame = project['name'] + identifier = project['identifier'] + reponame = project['reponame'] owner_id = project['user_id'] owner = User.find(owner_id) ownername = owner['login'] @@ -1402,7 +1403,10 @@ class ApplicationController < ActionController::Base updated_at = model['updated_at'] # 查询pull request对应的commit信息 - commits = Gitea::PullRequest::CommitsService.call(ownername, reponame, model['gitea_number']) + commits = Gitea::PullRequest::CommitsService.call(ownername, identifier, model['gitea_number']) + if commits.nil? + return false # 获取pr中变更的commit信息失败 + end commit_shas = [] commits.each do |c| commit_shas << c["Sha"] @@ -1439,7 +1443,8 @@ class ApplicationController < ActionController::Base end pull_request_id = model['id'] - reponame = project['name'] + identifier = project['identifier'] + reponame = project['reponame'] owner_id = project['user_id'] owner = User.find(owner_id) ownername = owner['login'] @@ -1450,7 +1455,10 @@ class ApplicationController < ActionController::Base updated_at = model['updated_at'] # 查询pull request对应的commit信息 - commits = Gitea::PullRequest::CommitsService.call(ownername, reponame, model['gitea_number']) + commits = Gitea::PullRequest::CommitsService.call(ownername, identifier, model['gitea_number']) + if commits.nil? + return false # 获取pr中变更的commit信息失败 + end commit_shas = [] commits.each do |c| commit_shas << c["Sha"]