|
|
|
@@ -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, |
|
|
|
|