|
|
|
@@ -2,9 +2,10 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions |
|
|
|
|
|
|
|
def new_index |
|
|
|
@files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows") |
|
|
|
puts @files |
|
|
|
@action_runs = Gitea::ActionRun.where(repo_id: @project.gpid) |
|
|
|
group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count |
|
|
|
@action_runs = @action_runs.where(id: params[:ids].split(",")) if params[:ids].present? |
|
|
|
@action_runs = @action_runs.where(workflow_id: params[:workflow_ids].split(",")) if params[:workflow_ids].present? |
|
|
|
group_data = @action_runs.group(:workflow_id, :status).count |
|
|
|
@result = [] |
|
|
|
@files.map{|i|i['name']}.each do |file| |
|
|
|
last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first |
|
|
|
@@ -27,7 +28,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions |
|
|
|
group_data.each do |k,v| |
|
|
|
total += v if k[0] == file |
|
|
|
success += v if k[0] == file && k[1] == 1 |
|
|
|
failure += v if k[0] == file && k[1] == 1 |
|
|
|
failure += v if k[0] == file && k[1] == 2 |
|
|
|
end |
|
|
|
|
|
|
|
@result << { |
|
|
|
|