From 8a052e30d8773f8be2151b31e021174456f78af4 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 11 Feb 2025 09:12:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/actions/actions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/actions/actions_controller.rb b/app/controllers/api/v1/projects/actions/actions_controller.rb index 824d966ea..0769a2e78 100644 --- a/app/controllers/api/v1/projects/actions/actions_controller.rb +++ b/app/controllers/api/v1/projects/actions/actions_controller.rb @@ -1,7 +1,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions::BaseController def new_index - @files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows") + @files = $gitea_client.get_repos_contents_by_owner_repo_filepath(@project&.owner&.login, @project&.identifier, ".gitea/workflows") rescue [] @action_runs = Gitea::ActionRun.where(repo_id: @project.gpid) @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? From 98a2bc5b4a7fe151b462b5abfed0d0cfb7bd64a7 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 11 Feb 2025 11:20:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v1/projects/actions/actions_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/actions/actions_controller.rb b/app/controllers/api/v1/projects/actions/actions_controller.rb index 0769a2e78..1adf75c35 100644 --- a/app/controllers/api/v1/projects/actions/actions_controller.rb +++ b/app/controllers/api/v1/projects/actions/actions_controller.rb @@ -2,12 +2,16 @@ 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") 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? - @action_runs = @action_runs.where(workflow_id: params[:workflow_ids].split(",")) if params[:workflow_ids].present? + @action_runs = @action_runs.where(workflows: @workflows) if params[:workflows].present? group_data = @action_runs.where(status: [1,2]).group(:workflow_id, :status).count @result = [] @files.map{|i|i['name']}.each do |file| + if @workflows.present? + next !@workflows.include?(file) + end last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first last_action_run_json = last_action_run.present? ? { id: last_action_run.id, From 6096234742c3d14fb2159e8db11f15128707f9f8 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 11 Feb 2025 11:26:02 +0800 Subject: [PATCH 3/4] fix --- app/controllers/api/v1/projects/actions/actions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/actions/actions_controller.rb b/app/controllers/api/v1/projects/actions/actions_controller.rb index 1adf75c35..ea4023941 100644 --- a/app/controllers/api/v1/projects/actions/actions_controller.rb +++ b/app/controllers/api/v1/projects/actions/actions_controller.rb @@ -5,7 +5,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions @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? - @action_runs = @action_runs.where(workflows: @workflows) if params[:workflows].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 = [] @files.map{|i|i['name']}.each do |file| From 62eeda7007fe2f496f47beeeb4417245861600ec Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 11 Feb 2025 11:31:14 +0800 Subject: [PATCH 4/4] fix --- app/controllers/api/v1/projects/actions/actions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/actions/actions_controller.rb b/app/controllers/api/v1/projects/actions/actions_controller.rb index ea4023941..b70e2fdf6 100644 --- a/app/controllers/api/v1/projects/actions/actions_controller.rb +++ b/app/controllers/api/v1/projects/actions/actions_controller.rb @@ -10,7 +10,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions @result = [] @files.map{|i|i['name']}.each do |file| if @workflows.present? - next !@workflows.include?(file) + next if !@workflows.include?(file) end last_action_run = @action_runs.where(workflow_id: file).order(updated: :desc).first last_action_run_json = last_action_run.present? ? {