Skip to content

Commit

Permalink
[CI] Adds branch option to docs report download
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Jan 5, 2024
1 parent c6954fc commit f7e41ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rake_tasks/doc_generator.rake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace :docs do
end

desc 'Update report'
task :update do
task :update, [:branch] do |_, args|
require 'elastic-transport'
github_token = File.read(File.expand_path("~/.elastic/github.token"))
transport_options = {
Expand All @@ -60,9 +60,11 @@ namespace :docs do
transport_options:transport_options
)
path = '/repos/elastic/clients-flight-recorder/contents/recordings/docs/parsed-alternative-report.json'
path = "#{path}?ref=#{args[:branch]}" if args[:branch]
params = {}
response = client.perform_request('GET', path, params)
File.write(File.expand_path('./docs/parsed_alternative_report.json', __dir__), response.body)
puts "Downloaded report for #{args[:branch] ? args[:branch] : 'main' } branch"
end

def json_data
Expand Down

0 comments on commit f7e41ee

Please sign in to comment.