流水线列表新接口,同步启用禁用状态

This commit is contained in:
xxq250 2025-03-17 11:35:19 +08:00
parent 0c5395bff6
commit cf72921eb1
1 changed files with 3 additions and 1 deletions

View File

@ -11,11 +11,13 @@ 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: false,
disable: disabled_workflows.include?(file.to_s),
project_id: @project.id)
interactor = Repositories::EntriesInteractor.call(@owner, @project.identifier, ".gitea/workflows/#{file}", ref: @project.default_branch)
if interactor.success?