fastlane-plugin-wpmreleasetoolkit 8.0.1 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a30c7fbc5b73296e2cf32c95f10a031e9261e13e33c48c140c249e9878016be8
4
- data.tar.gz: dcb8357f5c9b2427ddc2fffba59c0dcec48bbb3f8a85d09c515396e8a48d1cc1
3
+ metadata.gz: 800ea2231ea5727ef5d9f529e38802b18b947bfd124d5a904c5ee9eef29cf389
4
+ data.tar.gz: 742331639d6749c92bc2303d0a8303fc790a90517c46262410f259b99ea174fe
5
5
  SHA512:
6
- metadata.gz: 842d5a6dda8be7240dfae234f44cbad7ba1a7fb6af511f6ae608f66aad26dc75a68f6cc082a68b367b62944fcf9071fbe05c419dc1890d693ac84f2b6e7c8b3e
7
- data.tar.gz: c38bba91ab8e53a46f4b099527337e307f5395084f57c69f36ad72dc1c8d433ef8eaad1cbd26265ad351b2b54d2244bae49080a15eda1819cc8c60ca65762d9c
6
+ metadata.gz: d7017d051cea5a6be3a734dbba0ad1b0e8d7f3bb372aa0b62af9bc113546fbbcb429c24c48e8edbeae28d80f502c5886ab891c696415772731e4123a5f3a1cc3
7
+ data.tar.gz: 5f4c26332afb18a947df9368ba9efc1f9508db854c0270fd84e5a12125c31f2bc89695b6311efb5e3cd6047a54b7c73efe8da5288cc5bd334461c85952db871a
@@ -10,12 +10,13 @@ module Fastlane
10
10
  UI.message "Locales: #{params[:locales].inspect}"
11
11
  UI.message "Source locale: #{params[:source_locale].nil? ? '-' : params[:source_locale]}"
12
12
  UI.message "Path: #{params[:download_path]}"
13
+ UI.message "Auto-retry: #{params[:auto_retry]}"
13
14
 
14
15
  # Check download path
15
16
  FileUtils.mkdir_p(params[:download_path])
16
17
 
17
18
  # Download
18
- downloader = Fastlane::Helper::MetadataDownloader.new(params[:download_path], params[:target_files])
19
+ downloader = Fastlane::Helper::MetadataDownloader.new(params[:download_path], params[:target_files], params[:auto_retry])
19
20
 
20
21
  params[:locales].each do |loc|
21
22
  if loc.is_a?(Array)
@@ -68,6 +69,12 @@ module Fastlane
68
69
  env_name: 'FL_DOWNLOAD_METADATA_DOWNLOAD_PATH',
69
70
  description: 'The path of the target files',
70
71
  type: String),
72
+ FastlaneCore::ConfigItem.new(key: :auto_retry,
73
+ env_name: 'FL_DOWNLOAD_METADATA_AUTO_RETRY',
74
+ description: 'Whether to auto retry downloads after Too Many Requests error',
75
+ type: FastlaneCore::Boolean,
76
+ optional: true,
77
+ default_value: true),
71
78
  ]
72
79
  end
73
80
 
@@ -4,12 +4,17 @@ require 'json'
4
4
  module Fastlane
5
5
  module Helper
6
6
  class MetadataDownloader
7
+ AUTO_RETRY_SLEEP_TIME = 20
8
+ MAX_AUTO_RETRY_ATTEMPTS = 30
9
+
7
10
  attr_reader :target_folder, :target_files
8
11
 
9
- def initialize(target_folder, target_files)
12
+ def initialize(target_folder, target_files, auto_retry)
10
13
  @target_folder = target_folder
11
14
  @target_files = target_files
15
+ @auto_retry = auto_retry
12
16
  @alternates = {}
17
+ @auto_retry_attempt_counter = 0
13
18
  end
14
19
 
15
20
  # Downloads data from GlotPress, in JSON format
@@ -112,8 +117,13 @@ module Fastlane
112
117
  UI.message("Received 301 for `#{locale}`. Following redirect...")
113
118
  download(locale, response.header['location'], is_source)
114
119
  when '429'
115
- # We got rate-limited, offer to try again
116
- if UI.confirm("Retry downloading `#{locale}` after receiving 429 from the API?")
120
+ # We got rate-limited, auto_retry or offer to try again with a prompt
121
+ if @auto_retry && @auto_retry_attempt_counter <= MAX_AUTO_RETRY_ATTEMPTS
122
+ UI.message("Received 429 for `#{locale}`. Auto retrying in #{AUTO_RETRY_SLEEP_TIME} seconds...")
123
+ sleep(AUTO_RETRY_SLEEP_TIME)
124
+ @auto_retry_attempt_counter += 1
125
+ download(locale, response.uri, is_source)
126
+ elsif UI.confirm("Retry downloading `#{locale}` after receiving 429 from the API?")
117
127
  download(locale, response.uri, is_source)
118
128
  else
119
129
  UI.error("Abandoning `#{locale}` download as requested.")
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Wpmreleasetoolkit
3
- VERSION = '8.0.1'
3
+ VERSION = '8.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-wpmreleasetoolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.1
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Automattic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-13 00:00:00.000000000 Z
11
+ date: 2023-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport