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

This commit is contained in:
xxq250 2024-05-28 17:31:07 +08:00
parent 8325fa7367
commit 541815fb03
1 changed files with 4 additions and 2 deletions

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