From efdbc6fd4e251194c5c55a04bf8d3493583e6cb9 Mon Sep 17 00:00:00 2001 From: moshenglv Date: Tue, 19 Jan 2021 18:23:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=86=85=E5=AE=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ci/pipelines_controller.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/controllers/ci/pipelines_controller.rb b/app/controllers/ci/pipelines_controller.rb index dd1fe989..888d8a05 100644 --- a/app/controllers/ci/pipelines_controller.rb +++ b/app/controllers/ci/pipelines_controller.rb @@ -91,26 +91,23 @@ class Ci::PipelinesController < Ci::BaseController sha = get_pipeline_file_sha(pipeline.file_name) if sha pipeline.update!(sync: 1) - return update_trustie_pipeline(sha) + interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, params[:owner], params.merge(identifier: @project.identifier,sha: sha)) + if interactor.success? + render_ok + else + render_error(interactor.error) + end else interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) if interactor.success? pipeline.update!(sync: 1) + render_ok else render_error(interactor.error) end end end - def update_trustie_pipeline(sha) - interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, params[:owner], params.merge(identifier: @project.identifier,sha: sha)) - if interactor.success? - return render_ok("更新成功") - else - return render_error(interactor.error) - end - end - def content_params { filepath: params[:filepath],