mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-22 04:35:45 +08:00
ADD get .trustie-pipeline.yml file api with devops
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class ::DevOps::BuildsController < ApplicationController
|
||||
include RepositoriesHelper
|
||||
|
||||
before_action :require_login
|
||||
before_action :find_repo
|
||||
|
||||
@@ -36,6 +38,19 @@ class ::DevOps::BuildsController < ApplicationController
|
||||
render json: result
|
||||
end
|
||||
|
||||
# get .trustie-pipeline.yml file
|
||||
def get_trustie_pipeline
|
||||
file_path_uri = URI.parse('.trustie-pipeline.yml')
|
||||
interactor = Repositories::EntriesInteractor.call(@repo.user, @repo.identifier, file_path_uri, ref: params[:ref] || "master")
|
||||
if interactor.success?
|
||||
file = interactor.result
|
||||
return render json: {} if file[:status]
|
||||
|
||||
json = {name: file['name'], path: file['path'], content: render_decode64_content(file['content'])}
|
||||
render json: json
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_repo
|
||||
@repo = ::Repository.find params[:id]
|
||||
|
||||
Reference in New Issue
Block a user