| @@ -91,26 +91,23 @@ class Ci::PipelinesController < Ci::BaseController | |||||
| sha = get_pipeline_file_sha(pipeline.file_name) | sha = get_pipeline_file_sha(pipeline.file_name) | ||||
| if sha | if sha | ||||
| pipeline.update!(sync: 1) | pipeline.update!(sync: 1) | ||||
| return update_trustie_pipeline(sha) | |||||
| interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, params[:owner], params.merge(identifier: @project.identifier,sha: sha)) | |||||
| if interactor.success? | |||||
| render_ok | |||||
| else | |||||
| render_error(interactor.error) | |||||
| end | |||||
| else | else | ||||
| interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) | interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) | ||||
| if interactor.success? | if interactor.success? | ||||
| pipeline.update!(sync: 1) | pipeline.update!(sync: 1) | ||||
| render_ok | |||||
| else | else | ||||
| render_error(interactor.error) | render_error(interactor.error) | ||||
| end | end | ||||
| end | end | ||||
| end | end | ||||
| def update_trustie_pipeline(sha) | |||||
| interactor = Gitea::UpdateFileInteractor.call(current_user.gitea_token, params[:owner], params.merge(identifier: @project.identifier,sha: sha)) | |||||
| if interactor.success? | |||||
| return render_ok("更新成功") | |||||
| else | |||||
| return render_error(interactor.error) | |||||
| end | |||||
| end | |||||
| def content_params | def content_params | ||||
| { | { | ||||
| filepath: params[:filepath], | filepath: params[:filepath], | ||||