fixed: 流水线批量查询运行数据,改成一维数据方便使用,增加类型识别

This commit is contained in:
xxq250 2025-01-24 09:45:47 +08:00
parent a26bbf35c5
commit 5540d8732c
1 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
pipeline_type = 1
begin
content = Gitea::Repository::Entries::GetService.call(@project&.owner, @project&.identifier, URI.escape(file), ref: last_action_run.present? ? last_action_run.gsub("refs/heads/","") : @project.default_branch)['content']
content = Gitea::Repository::Entries::GetService.call(@project&.owner, @project&.identifier, URI.escape(file), ref: last_action_run.present? ? last_action_run.ref.gsub("refs/heads/","") : @project.default_branch)['content']
yaml_string = Base64.decode64(content).force_encoding("GBK").encode("UTF-8") unless Base64.decode64(content).force_encoding('UTF-8').valid_encoding?
yaml_string = Base64.decode64(content).force_encoding('UTF-8')
yml = YAML.safe_load(yaml_string)
@ -43,7 +43,7 @@ class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions
end
@result << {
name: file.to_s.gsub(".yml","").gsub(".yaml","") ,
branch: last_action_run.present? ? last_action_run.gsub("refs/heads/","") : @project.default_branch,
branch: last_action_run.present? ? last_action_run.ref.gsub("refs/heads/","") : @project.default_branch,
pipeline_type: pipeline_type,
total: total,
success: success,