mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-21 20:25:45 +08:00
流水线保存接口
This commit is contained in:
@@ -76,16 +76,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||
@pipeline = Action::Pipeline.new(pipeline_name: params[:pipeline_name], project_id: @project.id)
|
||||
@pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml"
|
||||
@pipeline.branch = params[:branch] || @project.default_branch
|
||||
@pipeline.json = params[:pipeline_json].to_json
|
||||
pipeline_yaml = build_pipeline_yaml(params[:pipeline_name], params[:pipeline_json])
|
||||
tip_exception("流水线yaml内空不能为空") if pipeline_yaml.blank?
|
||||
@pipeline.yaml = pipeline_yaml
|
||||
@pipeline.is_graphic_design = params[:pipeline_type] == 2 ? true : false
|
||||
@pipeline.save!
|
||||
sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
|
||||
tip_exception("#{@pipeline.file_name}已存在") if sha
|
||||
interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create"))
|
||||
tip_exception(interactor.error) unless interactor.success?
|
||||
render_ok({ id: @pipeline.id })
|
||||
end
|
||||
|
||||
def save_yaml
|
||||
|
||||
Reference in New Issue
Block a user