Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop
This commit is contained in:
		
						commit
						bb14883e31
					
				| 
						 | 
				
			
			@ -1,13 +1,17 @@
 | 
			
		|||
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 []
 | 
			
		||||
    @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(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| 
 | 
			
		||||
      if @workflows.present?
 | 
			
		||||
        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? ? {
 | 
			
		||||
        id: last_action_run.id,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue