获取代码库文件sha

This commit is contained in:
victor 2021-02-01 16:19:42 +08:00
parent ce31875c19
commit 155fc35cfa
1 changed files with 1 additions and 6 deletions

View File

@ -61,12 +61,10 @@ class Ci::PipelinesController < Ci::BaseController
sha = get_pipeline_file_sha(pipeline.file_name, pipeline.branch)
if sha
logger.info "#{pipeline.file_name}已存在"
pipeline.update!(sync: 1, sha: sha)
else
interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params)
if interactor.success?
logger.info "#{pipeline.file_name}创建成功"
pipeline.update!(sync: 1, sha: interactor.result['content']['sha'])
end
end
end
@ -155,10 +153,7 @@ class Ci::PipelinesController < Ci::BaseController
end
end
end
@sha = pipeline.sha
unless @sha
@sha = get_pipeline_file_sha(pipeline.file_name, pipeline.branch)
end
@sha = get_pipeline_file_sha(pipeline.file_name, pipeline.branch)
trigger = ''
trigger += " branch:\r\n - #{pipeline.branch}\r\n" unless pipeline.branch.blank?
unless pipeline.event.blank?