Browse Source

联调图形设计化-返回文件sha

pull/347/head
xxq250 2 years ago
parent
commit
541815fb03
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      app/controllers/api/v1/projects/pipelines_controller.rb

+ 4
- 2
app/controllers/api/v1/projects/pipelines_controller.rb View File

@@ -35,7 +35,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
interactor = sha.present? ? Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update").merge(sha: sha)) : Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create"))
tip_exception(interactor.error) unless interactor.success?
render_ok({ pipeline_yaml: pipeline_yaml })
file = interactor.result
render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: file['content']['sha'] })
end

def build_yaml
@@ -61,7 +62,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("create").merge(sha: sha))
tip_exception(interactor.error) unless interactor.success?
render_ok
file = interactor.result
render_ok({ pipeline_yaml: pipeline_yaml, pipeline_name: params[:pipeline_name], file_name: @pipeline.file_name, sha: file['content']['sha'] })
end

def destroy


Loading…
Cancel
Save