From b21317eb0aedbf8ee540b8a27c5f5c41d12135a1 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 8 Apr 2025 09:30:43 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=8F=82=E6=95=B0=E4=B8=8D=E4=BC=A0?= =?UTF-8?q?=E6=97=B6=E5=A4=84=E7=90=86pipeline=5Fname?= 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, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index 5aa62caab..726f8a5c5 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -96,7 +96,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController @pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml" @pipeline.branch = params[:branch] || @project.default_branch @pipeline.json = params[:pipeline_json].to_json if params[:pipeline_json].present? - pipeline_yaml = params[:pipeline_yaml].present? ? params[:pipeline_yaml] : build_pipeline_yaml_new(params[:pipeline_name], params[:pipeline_json]) + @pipeline.pipeline_name = params[:pipeline_name] if params[:pipeline_name].present? + pipeline_yaml = params[:pipeline_yaml].present? ? params[:pipeline_yaml] : build_pipeline_yaml_new(@pipeline.pipeline_name, params[:pipeline_json]) tip_exception("流水线yaml内空不能为空") if pipeline_yaml.blank? @pipeline.yaml = pipeline_yaml Rails.logger.info "pipeline_yaml base64=========================#{Base64.encode64(@pipeline.yaml).gsub(/\n/, '')}" @@ -106,7 +107,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController file = interactor.result @pipeline.pipeline_type = @pipeline.json.present? ? 2 : 1 @pipeline.save - render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] }) + render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: @pipeline.pipeline_name, file_name: @pipeline.file_name, sha: sha.present? ? sha : file['content']['sha'] }) end def build_yaml