Skip to content

Commit 4caa70c

Browse files
committed
[DOCS] Adds task to update parsed alternative report
1 parent d3ff035 commit 4caa70c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rake_tasks/doc_generator.rake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ namespace :docs do
4444
puts "Finished generating #{entries.length} files in #{Time.now.to_i - start_time} seconds"
4545
end
4646

47+
desc 'Update report'
48+
task :update do
49+
require 'elastic-transport'
50+
github_token = File.read(File.expand_path("~/.elastic/github.token"))
51+
transport_options = {
52+
headers: {
53+
Accept: 'application/vnd.github.v3.raw',
54+
Authorization: "token #{github_token}"
55+
}
56+
}
57+
client = Elastic::Transport::Client.new(
58+
host: 'https://api.github.com/',
59+
transport_options:transport_options
60+
)
61+
path = '/repos/elastic/clients-flight-recorder/contents/recordings/docs/parsed-alternative-report.json'
62+
params = {}
63+
response = client.perform_request('GET', path, params)
64+
File.write(File.expand_path('./docs/parsed_alternative_report.json', __dir__), response.body)
65+
end
66+
4767
def json_data
4868
JSON.parse(File.read(SRC_FILE))
4969
end

0 commit comments

Comments
 (0)