diff --git a/app/controllers/api/v1/projects/actions/actions_controller.rb b/app/controllers/api/v1/projects/actions/actions_controller.rb index 5d494d288..824d966ea 100644 --- a/app/controllers/api/v1/projects/actions/actions_controller.rb +++ b/app/controllers/api/v1/projects/actions/actions_controller.rb @@ -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,