fixed 流水线禁用状态
This commit is contained in:
parent
6068d44d62
commit
137a67fe53
|
@ -8,6 +8,8 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||||
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid)
|
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid)
|
||||||
group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count
|
group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count
|
||||||
db_files = pipelines.pluck(:file_name)
|
db_files = pipelines.pluck(:file_name)
|
||||||
|
disabled_config = Gitea::RepoUnit.where(repo_id: @project.gpid, type: 10)&.first&.config
|
||||||
|
@disabled_workflows = disabled_config.present? ? JSON.parse(disabled_config)["DisabledWorkflows"] : []
|
||||||
@run_result = []
|
@run_result = []
|
||||||
@files.map { |i| i['name'] }.each do |file|
|
@files.map { |i| i['name'] }.each do |file|
|
||||||
unless db_files.include?(".gitea/workflows/#{file}")
|
unless db_files.include?(".gitea/workflows/#{file}")
|
||||||
|
@ -17,7 +19,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||||
file_name: ".gitea/workflows/#{file}",
|
file_name: ".gitea/workflows/#{file}",
|
||||||
branch: @project.default_branch,
|
branch: @project.default_branch,
|
||||||
is_graphic_design: false,
|
is_graphic_design: false,
|
||||||
disable: disabled_workflows.include?(file.to_s),
|
disable: @disabled_workflows.include?(file.to_s),
|
||||||
project_id: @project.id)
|
project_id: @project.id)
|
||||||
interactor = Repositories::EntriesInteractor.call(@owner, @project.identifier, ".gitea/workflows/#{file}", ref: @project.default_branch)
|
interactor = Repositories::EntriesInteractor.call(@owner, @project.identifier, ".gitea/workflows/#{file}", ref: @project.default_branch)
|
||||||
if interactor.success?
|
if interactor.success?
|
||||||
|
|
Loading…
Reference in New Issue