From 5fd5431d5cb84826a1ef58dd05044352195c1882 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 9 Apr 2025 15:11:21 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=AF=BC=E5=85=A5=E7=9A=84=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E7=BA=BF=E7=BB=9F=E4=B8=80=E5=85=88=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/pipelines_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index 915962e48..d8ec37083 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -13,13 +13,11 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController @run_result = [] @files.map { |i| i['name'] }.each do |file| unless db_files.include?(".gitea/workflows/#{file}") - disabled_config = Gitea::RepoUnit.where(repo_id: @project.gpid, type: 10)&.first&.config - disabled_workflows = disabled_config.present? ? JSON.parse(disabled_config)["DisabledWorkflows"] : [] pipeline = Action::Pipeline.new(pipeline_name: file.to_s.gsub(".yml", "").gsub(".yaml", ""), file_name: ".gitea/workflows/#{file}", branch: @project.default_branch, is_graphic_design: false, - disable: @disabled_workflows.include?(file.to_s), + disable: false, project_id: @project.id) interactor = Repositories::EntriesInteractor.call(@owner, @project.identifier, ".gitea/workflows/#{file}", ref: @project.default_branch) if interactor.success? @@ -27,6 +25,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController end pipeline.user_id = current_user.id pipeline.save + # 导入的流水线统一先禁用 + $gitea_hat_client.post_repos_actions_disable(@project&.owner&.login, @project&.identifier, {query: {workflow: file}}) rescue nil end last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first last_action_run_json = last_action_run.present? ? {