mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 20:55:46 +08:00
流水线启用状态,流水线设计时 id
This commit is contained in:
@@ -4,7 +4,9 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
||||
@files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows") rescue []
|
||||
@workflows = params[:workflows].split(",") if params[:workflows].present?
|
||||
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid)
|
||||
@action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present?
|
||||
disabled_config = Gitea::RepoUnit.where(repo_id: @project.gpid, type: 10)&.first&.config
|
||||
disabled_workflows = disabled_config.present? ? JSON.parse(disabled_config)["DisabledWorkflows"] : []
|
||||
@action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present?
|
||||
@action_runs = @action_runs.where(workflow_id: @workflows) if params[:workflows].present?
|
||||
group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count
|
||||
@result = []
|
||||
@@ -14,6 +16,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
||||
end
|
||||
last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first
|
||||
last_action_run_json = last_action_run.present? ? {
|
||||
pipeline_id: Action::Pipeline.find_by(pipeline_name: file, project_id: @project.id),
|
||||
id: last_action_run.id,
|
||||
schedule: last_action_run.schedule_id > 0,
|
||||
title: last_action_run.title,
|
||||
@@ -47,6 +50,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
|
||||
end
|
||||
@result << {
|
||||
filename: file,
|
||||
disabled: disabled_workflows.include?(file.to_s),
|
||||
name: file.to_s.gsub(".yml","").gsub(".yaml","") ,
|
||||
branch: last_action_run.present? ? last_action_run.ref.gsub("refs/heads/","") : @project.default_branch,
|
||||
pipeline_type: pipeline_type,
|
||||
|
||||
@@ -35,7 +35,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController
|
||||
end
|
||||
|
||||
def save_yaml
|
||||
@pipeline = Action::Pipeline.new(pipeline_name: params[:pipeline_name], project_id: @project.id)
|
||||
@pipeline = Action::Pipeline.find_or_initialize_by(pipeline_name: params[:pipeline_name], project_id: @project.id)
|
||||
@pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml"
|
||||
@pipeline.branch = params[:branch] || @project.default_branch
|
||||
@pipeline.json = params[:pipeline_json].to_json
|
||||
|
||||
Reference in New Issue
Block a user