From e2c5a2abaae962f2882928322a56473d07943eb0 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 5 Jun 2025 09:37:33 -0400 Subject: [PATCH] Fix `Style/FetchEnvVar` cop in `repo.rake` (#34903) Co-authored-by: Claire --- .rubocop_todo.yml | 1 - lib/tasks/repo.rake | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a4cf131691..641a7ec69a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -33,7 +33,6 @@ Style/FetchEnvVar: Exclude: - 'config/initializers/2_limited_federation_mode.rb' - 'config/initializers/paperclip.rb' - - 'lib/tasks/repo.rake' # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake index c8f977f651..6c696a9097 100644 --- a/lib/tasks/repo.rake +++ b/lib/tasks/repo.rake @@ -57,7 +57,7 @@ namespace :repo do response = nil loop do - response = HTTP.headers('Authorization' => "token #{ENV['GITHUB_API_TOKEN']}").get("https://api.github.com/repos/#{REPOSITORY_NAME}/pulls/#{pull_request_number}") + response = HTTP.headers('Authorization' => "token #{ENV.fetch('GITHUB_API_TOKEN')}").get("https://api.github.com/repos/#{REPOSITORY_NAME}/pulls/#{pull_request_number}") if response.code == 403 sleep_for = (response.headers['X-RateLimit-Reset'].to_i - Time.now.to_i).abs