forked from Trustie/forgeplus
fixed 流水线重命名的新文件存在时,直接修改新文件new_file_sha
This commit is contained in:
parent
d8b9de87e6
commit
a23a4dd270
|
|
@ -80,7 +80,12 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
|||
tip_exception("已经存在#{params[:pipeline_name]}流水线!") if has_pipeline.present?
|
||||
if @pipeline.yaml.present?
|
||||
sha = get_pipeline_file_sha(@pipeline.file_name, @pipeline.branch)
|
||||
if sha.present?
|
||||
new_file_sha = get_pipeline_file_sha(params[:pipeline_name], @pipeline.branch)
|
||||
# 重命名的新文件存在时,直接修改新文件new_file_sha
|
||||
if sha.present? && new_file_sha.present?
|
||||
interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update", params[:pipeline_name]).merge(sha: new_file_sha, from_path: ".gitea/workflows/#{@pipeline.pipeline_name}.yml"))
|
||||
tip_exception(interactor.error) unless interactor.success?
|
||||
else
|
||||
interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, @owner.login, content_params("update", params[:pipeline_name]).merge(sha: sha, from_path: ".gitea/workflows/#{@pipeline.pipeline_name}.yml"))
|
||||
tip_exception(interactor.error) unless interactor.success?
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue