From 64cbd74e5d0352a4f1e2599fb96b740efb8fc5af Mon Sep 17 00:00:00 2001 From: Zhu Sheng Li Date: Thu, 2 Apr 2020 22:46:39 +0800 Subject: [PATCH] fix: disable preview api warning from octokit.rb octokit outputs warning message for preview API such as `issue_events`, which is annoying. We can explicitly add the accept option when calling the API to disable it. Refer to `lib/octokit/preview.rb` in octokit for more information. fix: #773 --- lib/github_changelog_generator/octo_fetcher.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index 57f70914d..9fdfe1221 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -187,12 +187,14 @@ def fetch_closed_pull_requests def fetch_events_async(issues) i = 0 threads = [] + # Add accept option explicitly for disabling the warning of preview API. + preview = { accept: Octokit::Preview::PREVIEW_TYPES[:project_card_events] } issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice| issues_slice.each do |issue| threads << Thread.new do issue["events"] = [] - iterate_pages(@client, "issue_events", issue["number"]) do |new_event| + iterate_pages(@client, "issue_events", issue["number"], preview) do |new_event| issue["events"].concat(new_event) end issue["events"] = issue["events"].map { |event| stringify_keys_deep(event.to_hash) }