Skip to content

Commit 45a1c62

Browse files
committed
Merge branch 'trunk' into ftl-exclude
# Conflicts: # CHANGELOG.md
2 parents 7dc2965 + eab670b commit 45a1c62

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ _None_
1010

1111
### New Features
1212

13+
- Propose to retry when the download of GlotPress translations failed for a locale (especially useful for occurrences of `429 - Too Many Requests` quota limits) [#402]
1314
- Add a `test_targets` parameter to the `android_firebase_test` action to be able to filter the tests to be run. [#403]
1415

1516
### Bug Fixes

lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def self.download_glotpress_export_file(project_url:, locale:, filters:)
291291
uri.open(options) { |f| Nokogiri::XML(f.read.gsub("\t", ' '), nil, Encoding::UTF_8.to_s) }
292292
rescue StandardError => e
293293
UI.error "Error downloading #{locale} - #{e.message}"
294+
retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
294295
return nil
295296
end
296297
end

lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def self.download_glotpress_export_file(project_url:, locale:, filters:, destina
152152
IO.copy_stream(uri.open(options), destination)
153153
rescue StandardError => e
154154
UI.error "Error downloading locale `#{locale}` — #{e.message} (#{uri})"
155+
retry if e.is_a?(OpenURI::HTTPError) && UI.confirm("Retry downloading `#{locale}`?")
155156
return nil
156157
end
157158
end

spec/ios_download_strings_files_from_glotpress_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def test_gp_download(filters:, tablename:, expected_gp_params:)
7070
stub = gp_stub(locale: 'unknown-locale', query: { 'filters[status]': 'current', format: 'strings' }).to_return(status: [404, 'Not Found'])
7171
error_messages = []
7272
allow(FastlaneCore::UI).to receive(:error) { |message| error_messages.append(message) }
73+
allow(FastlaneCore::UI).to receive(:confirm).and_return(false) # as we will be asked if we want to retry when getting a network error
7374

7475
# Act
7576
run_described_fastlane_action(

spec/ios_l10n_helper_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ def file_encoding(path)
260260
stub = stub_request(:get, "#{gp_fake_url}/invalid/default/export-translations/").with(query: { format: 'strings' }).to_return(status: [404, 'Not Found'])
261261
error_messages = []
262262
allow(FastlaneCore::UI).to receive(:error) { |message| error_messages.append(message) }
263+
allow(FastlaneCore::UI).to receive(:confirm).and_return(false) # as we will be asked if we want to retry when getting a network error
263264
dest = StringIO.new
264265
# Act
265266
described_class.download_glotpress_export_file(project_url: gp_fake_url, locale: 'invalid', filters: nil, destination: dest)

0 commit comments

Comments
 (0)