From 98a2bc5b4a7fe151b462b5abfed0d0cfb7bd64a7 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 11 Feb 2025 11:20:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E:=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=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,