From 8760e46c4b3e3ad8d12ba10209b565b8b72c60dd Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 23 May 2024 10:44:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=B5=81=E6=B0=B4=E7=BA=BFya?= =?UTF-8?q?ml=20base64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/pipelines_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index c1edcbbd2..6cd4bff67 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -18,7 +18,6 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController @pipeline.yaml = pipeline_yaml @pipeline.save! sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch) - Rails.logger.info "sha==========#{sha}" tip_exception("#{@pipeline.file_name}已存在") if sha interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) tip_exception(interactor.error) unless interactor.success? @@ -34,8 +33,6 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController tip_exception("流水线yaml内空不能为空") if pipeline_yaml.blank? @pipeline.yaml = pipeline_yaml sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch) - Rails.logger.info "sha==========#{sha}" - Rails.logger.info "sha==========#{sha.present?}" interactor = sha.present? ? Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) : Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) tip_exception(interactor.error) unless interactor.success? render_ok @@ -147,7 +144,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController filepath: ".gitea/workflows/#{URI.parse(@pipeline.pipeline_name)}.yaml", branch: @pipeline.branch, new_branch: @pipeline.branch, - content: @pipeline.yaml, + content: Base64.encode64(@pipeline.yaml), message: 'create pipeline', committer: { email: current_user.mail,