fastlane-plugin-wpmreleasetoolkit 8.1.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +7 -7
  3. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +1 -1
  4. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +1 -1
  5. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +2 -2
  6. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +1 -1
  7. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +1 -1
  8. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +3 -2
  9. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +1 -1
  10. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +3 -3
  11. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +4 -4
  12. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +1 -1
  13. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +1 -1
  14. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +1 -1
  15. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_firebase_test.rb +1 -1
  16. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotfix_prechecks.rb +1 -1
  17. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +1 -1
  18. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +1 -1
  19. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +1 -1
  20. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +4 -3
  21. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +3 -3
  22. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/find_previous_tag.rb +58 -0
  23. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb +112 -0
  24. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +5 -5
  25. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +3 -3
  26. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +24 -24
  27. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_to_s3.rb +37 -5
  28. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +3 -3
  29. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +3 -3
  30. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +2 -2
  31. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +3 -3
  32. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +2 -2
  33. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +2 -2
  34. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +1 -1
  35. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +4 -4
  36. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +1 -1
  37. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +5 -7
  38. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +3 -22
  39. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +6 -20
  40. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +1 -1
  41. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +1 -1
  42. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +1 -1
  43. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +11 -4
  44. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotfix_prechecks.rb +1 -1
  45. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +2 -2
  46. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +2 -2
  47. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +4 -4
  48. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +2 -2
  49. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +6 -6
  50. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +39 -41
  51. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +10 -11
  52. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +1 -1
  53. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +1 -1
  54. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +39 -1
  55. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +2 -2
  56. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +2 -55
  57. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +3 -3
  58. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +42 -52
  59. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +13 -13
  60. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +2 -2
  61. data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +11 -11
  62. data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +3 -1
  63. metadata +26 -13
  64. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +0 -66
  65. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +0 -43
  66. data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 800ea2231ea5727ef5d9f529e38802b18b947bfd124d5a904c5ee9eef29cf389
4
- data.tar.gz: 742331639d6749c92bc2303d0a8303fc790a90517c46262410f259b99ea174fe
3
+ metadata.gz: 423e3fa0c8f65af81619e52a547d87a491b532bbab62680b5b5cba1ccfd72d10
4
+ data.tar.gz: 94974b14aba25d84ffd22d5a6139bf9a0354cd4b61087acd9b8feef28a104fe4
5
5
  SHA512:
6
- metadata.gz: d7017d051cea5a6be3a734dbba0ad1b0e8d7f3bb372aa0b62af9bc113546fbbcb429c24c48e8edbeae28d80f502c5886ab891c696415772731e4123a5f3a1cc3
7
- data.tar.gz: 5f4c26332afb18a947df9368ba9efc1f9508db854c0270fd84e5a12125c31f2bc89695b6311efb5e3cd6047a54b7c73efe8da5288cc5bd334461c85952db871a
6
+ metadata.gz: c340386d587df81c06aa77158d6e37ceb7f9959953f3c853c9766e77ba4d1054e6304615e4625611374bd11591e4b53437413b694c93a4315721c2b6cd74727b
7
+ data.tar.gz: b9f1fc5e641b5f6d67fc42a803f035fdc1ebd93bd36f376f6da09b74d8282d42c233d8c7d87636837a5e5d3122188083367695e30a8ee8ae01623ef2c379fabe
@@ -71,17 +71,17 @@ module Fastlane
71
71
  @blocks = []
72
72
 
73
73
  # Inits default handler
74
- @blocks.push Fastlane::Helper::UnknownMetadataBlock.new
74
+ @blocks.push Fastlane::Helper::AnUnknownMetadataBlock.new
75
75
 
76
76
  # Init special handlers
77
77
  block_files.each do |key, file_path|
78
78
  case key
79
79
  when :release_note
80
- @blocks.push Fastlane::Helper::ReleaseNoteMetadataBlock.new(key, file_path, release_version)
80
+ @blocks.push Fastlane::Helper::AnReleaseNoteMetadataBlock.new(key, file_path, release_version)
81
81
  when :release_note_short
82
- @blocks.push Fastlane::Helper::ReleaseNoteShortMetadataBlock.new(key, file_path, release_version)
82
+ @blocks.push Fastlane::Helper::AnReleaseNoteShortMetadataBlock.new(key, file_path, release_version)
83
83
  else
84
- @blocks.push Fastlane::Helper::StandardMetadataBlock.new(key, file_path)
84
+ @blocks.push Fastlane::Helper::AnStandardMetadataBlock.new(key, file_path)
85
85
  end
86
86
  end
87
87
 
@@ -133,21 +133,21 @@ module Fastlane
133
133
  description: 'The path of the .po file to update',
134
134
  type: String,
135
135
  verify_block: proc do |value|
136
- UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
136
+ UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && !value.empty?
137
137
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
138
138
  end),
139
139
  FastlaneCore::ConfigItem.new(key: :release_version,
140
140
  env_name: 'FL_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
141
141
  description: 'The release version of the app (to use to mark the release notes)',
142
142
  verify_block: proc do |value|
143
- UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
143
+ UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && !value.empty?
144
144
  end),
145
145
  FastlaneCore::ConfigItem.new(key: :source_files,
146
146
  env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
147
147
  description: 'The hash with the path to the source files and the key to use to include their content',
148
148
  type: Hash,
149
149
  verify_block: proc do |value|
150
- UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
150
+ UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && !value.empty?
151
151
  end),
152
152
  ]
153
153
  end
@@ -12,7 +12,7 @@ module Fastlane
12
12
  source_diff = nil
13
13
  if diff_url.nil? == false
14
14
  data = open(params[:diff_url])
15
- source_diff = data.read()
15
+ source_diff = data.read
16
16
  end
17
17
 
18
18
  any_error = false
@@ -42,7 +42,7 @@ module Fastlane
42
42
  end
43
43
 
44
44
  # Check local repo status
45
- other_action.ensure_git_status_clean()
45
+ other_action.ensure_git_status_clean
46
46
 
47
47
  # Return the current version
48
48
  [next_beta_version, next_alpha_version]
@@ -7,7 +7,7 @@ module Fastlane
7
7
 
8
8
  UI.user_error!("Can't build beta and final at the same time!") if params[:final] && params[:beta]
9
9
 
10
- Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci()
10
+ Fastlane::Helper::GitHelper.ensure_on_branch!('release') unless other_action.is_ci
11
11
 
12
12
  message = ''
13
13
  beta_version = Fastlane::Helper::Android::VersionHelper.get_release_version unless !params[:beta] && !params[:final]
@@ -26,7 +26,7 @@ module Fastlane
26
26
  end
27
27
 
28
28
  # Check local repo status
29
- other_action.ensure_git_status_clean() unless other_action.is_ci()
29
+ other_action.ensure_git_status_clean unless other_action.is_ci
30
30
  end
31
31
 
32
32
  #####################################################
@@ -25,7 +25,7 @@ module Fastlane
25
25
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
26
26
  UI.message 'Done!'
27
27
 
28
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
28
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
29
29
  end
30
30
 
31
31
  #####################################################
@@ -23,7 +23,7 @@ module Fastlane
23
23
  Fastlane::Helper::Android::VersionHelper.update_versions(final_version, current_version_alpha)
24
24
  UI.message 'Done!'
25
25
 
26
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
26
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
27
27
  end
28
28
 
29
29
  #####################################################
@@ -21,7 +21,7 @@ module Fastlane
21
21
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version, nil)
22
22
  UI.message 'Done!'
23
23
 
24
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
24
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
25
25
 
26
26
  UI.message 'Done.'
27
27
  end
@@ -46,7 +46,8 @@ module Fastlane
46
46
  type: String),
47
47
  FastlaneCore::ConfigItem.new(key: :version_code,
48
48
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_CODE',
49
- description: 'The version code for the hotfix'),
49
+ description: 'The version code for the hotfix',
50
+ type: Integer),
50
51
  FastlaneCore::ConfigItem.new(key: :previous_version_name,
51
52
  env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
52
53
  description: 'The version to branch from',
@@ -36,7 +36,7 @@ module Fastlane
36
36
 
37
37
  UI.message 'Updating app version...'
38
38
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version_beta, new_version_alpha)
39
- Fastlane::Helper::Android::GitHelper.commit_version_bump()
39
+ Fastlane::Helper::Android::GitHelper.commit_version_bump
40
40
  UI.message 'Done.'
41
41
  end
42
42
 
@@ -1,8 +1,8 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class AndroidCodefreezePrechecksAction < Action
4
- VERSION_RELEASE = 'release'
5
- VERSION_ALPHA = 'alpha'
4
+ VERSION_RELEASE = 'release'.freeze
5
+ VERSION_ALPHA = 'alpha'.freeze
6
6
 
7
7
  def self.run(params)
8
8
  # fastlane will take care of reading in the parameter and fetching the environment variable:
@@ -33,7 +33,7 @@ module Fastlane
33
33
  end
34
34
 
35
35
  # Check local repo status
36
- other_action.ensure_git_status_clean()
36
+ other_action.ensure_git_status_clean
37
37
 
38
38
  # Return the current version
39
39
  Fastlane::Helper::Android::VersionHelper.get_public_version
@@ -13,14 +13,14 @@ module Fastlane
13
13
 
14
14
  version = Fastlane::Helper::Android::VersionHelper.get_public_version
15
15
  message = "Completing code freeze for: #{version}\n"
16
- unless params[:skip_confirm]
17
- UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
18
- else
16
+ if params[:skip_confirm]
19
17
  UI.message(message)
18
+ else
19
+ UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
20
20
  end
21
21
 
22
22
  # Check local repo status
23
- other_action.ensure_git_status_clean()
23
+ other_action.ensure_git_status_clean
24
24
 
25
25
  version
26
26
  end
@@ -53,7 +53,7 @@ module Fastlane
53
53
  description: 'The download folder',
54
54
  type: String,
55
55
  optional: true,
56
- default_value: Dir.tmpdir()),
56
+ default_value: Dir.tmpdir),
57
57
  FastlaneCore::ConfigItem.new(key: :github_release_prefix,
58
58
  description: 'The prefix which is used in the GitHub release title',
59
59
  type: String,
@@ -22,7 +22,7 @@ module Fastlane
22
22
 
23
23
  # Update submodules then lint translations
24
24
  unless params[:lint_task].nil? || params[:lint_task].empty?
25
- Fastlane::Helper::GitHelper.update_submodules()
25
+ Fastlane::Helper::GitHelper.update_submodules
26
26
  Action.sh('./gradlew', params[:lint_task])
27
27
  end
28
28
 
@@ -24,7 +24,7 @@ module Fastlane
24
24
  end
25
25
 
26
26
  # Check local repo status
27
- other_action.ensure_git_status_clean()
27
+ other_action.ensure_git_status_clean
28
28
 
29
29
  version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]
30
30
  end
@@ -16,7 +16,7 @@ module Fastlane
16
16
 
17
17
  # Log in to Firebase (and validate credentials)
18
18
  run_uuid = params[:test_run_id] || SecureRandom.uuid
19
- test_dir = params[:results_output_dir] || File.join(Dir.tmpdir(), run_uuid)
19
+ test_dir = params[:results_output_dir] || File.join(Dir.tmpdir, run_uuid)
20
20
 
21
21
  # Set up the log file and output directory
22
22
  FileUtils.mkdir_p(test_dir)
@@ -28,7 +28,7 @@ module Fastlane
28
28
  UI.crash!("Version #{prev_ver} is not tagged! Can't branch. Abort!") unless other_action.git_tag_exists(tag: prev_ver)
29
29
 
30
30
  # Check local repo status
31
- other_action.ensure_git_status_clean()
31
+ other_action.ensure_git_status_clean
32
32
 
33
33
  # Return the current version
34
34
  prev_ver
@@ -28,7 +28,7 @@ module Fastlane
28
28
  )
29
29
 
30
30
  if response.state == 'scheduled'
31
- UI.message("Successfully scheduled new build. You can see it at '#{response.web_url}'")
31
+ UI.success("Successfully scheduled new build. You can see it at '#{response.web_url}'")
32
32
  else
33
33
  UI.crash!("Failed to start job\nError: [#{response}]")
34
34
  end
@@ -113,7 +113,7 @@ module Fastlane
113
113
  type: Array,
114
114
  optional: true,
115
115
  # Default to Mag16.
116
- default_value: 'ar de es fr he id it ja ko nl pt-br ru sv tr zh-cn zh-tw'.split()),
116
+ default_value: 'ar de es fr he id it ja ko nl pt-br ru sv tr zh-cn zh-tw'.split),
117
117
  FastlaneCore::ConfigItem.new(key: :min_acceptable_translation_percentage,
118
118
  env_name: 'FL_CHECK_TRANSLATION_PROGRESS_MIN_ACCEPTABLE_TRANSLATION_PERCENTAGE',
119
119
  description: 'The threshold under which an error is raised',
@@ -16,7 +16,7 @@ module Fastlane
16
16
 
17
17
  milestone_duedate = last_stone[:due_on]
18
18
  milestone_duration = params[:milestone_duration]
19
- newmilestone_duedate = (milestone_duedate.to_datetime.next_day(milestone_duration).to_time).utc
19
+ newmilestone_duedate = milestone_duedate.to_datetime.next_day(milestone_duration).to_time.utc
20
20
  newmilestone_number = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(last_stone[:title])
21
21
  number_of_days_from_code_freeze_to_release = params[:number_of_days_from_code_freeze_to_release]
22
22
  # Because of the app stores review process, we submit the binary 3 days before the intended release date.
@@ -23,7 +23,7 @@ module Fastlane
23
23
  end
24
24
 
25
25
  github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token])
26
- github_helper.create_release(
26
+ url = github_helper.create_release(
27
27
  repository: repository,
28
28
  version: version,
29
29
  target: params[:target],
@@ -32,7 +32,8 @@ module Fastlane
32
32
  prerelease: prerelease,
33
33
  is_draft: is_draft
34
34
  )
35
- UI.message('Done')
35
+ UI.success("Successfully created GitHub Release. You can see it at '#{url}'")
36
+ url
36
37
  end
37
38
 
38
39
  def self.description
@@ -44,7 +45,7 @@ module Fastlane
44
45
  end
45
46
 
46
47
  def self.return_value
47
- # If your method provides a return value, you can describe here what it does
48
+ 'The URL of the created GitHub Release'
48
49
  end
49
50
 
50
51
  def self.details
@@ -15,7 +15,7 @@ module Fastlane
15
15
  end
16
16
 
17
17
  unless extracted_notes_file.nil?
18
- extracted_notes_file.close()
18
+ extracted_notes_file.close
19
19
  check_and_commit_extracted_notes_file(extracted_notes_file_path, version)
20
20
  end
21
21
  end
@@ -25,9 +25,9 @@ module Fastlane
25
25
  File.open(release_notes_file_path).each do |line|
26
26
  case state
27
27
  when :discarding
28
- state = :evaluating if (line.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/)) && (line.strip() == version)
28
+ state = :evaluating if line.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/) && (line.strip == version)
29
29
  when :evaluating
30
- state = (line.match(/-/)) ? :extracting : :discarding
30
+ state = line.match(/-/) ? :extracting : :discarding
31
31
  when :extracting
32
32
  if line.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/)
33
33
  state = :discarding
@@ -0,0 +1,58 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/github_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class FindPreviousTagAction < Action
7
+ def self.run(params)
8
+ tag_pattern = params[:pattern]
9
+
10
+ # Make sure we have all the latest tags fetched locally
11
+ Actions.sh('git', 'fetch', '--tags', '--force') { nil }
12
+ # Check if the current commit has a tag, so we can exclude it and not risk returning the current commit tag instead of really-previous one
13
+ current_commit_tag = Actions.sh('git describe --tags --exact-match 2>/dev/null || true').chomp
14
+
15
+ # Finally find the previous tag matching the provided pattern, and that is not the current commit
16
+ git_cmd = %w[git describe --tags --abbrev=0]
17
+ git_cmd += ['--match', tag_pattern] unless tag_pattern.nil?
18
+ git_cmd += ['--exclude', current_commit_tag] unless current_commit_tag.empty?
19
+ Actions.sh(*git_cmd) { |exit_status, stdout, _| exit_status.success? ? stdout.chomp : nil }
20
+ end
21
+
22
+ def self.description
23
+ 'Use `git describe` to find the previous tag matching a specific pattern'
24
+ end
25
+
26
+ def self.authors
27
+ ['Automattic']
28
+ end
29
+
30
+ def self.return_value
31
+ 'The name of the previous tag matching the pattern, or nil if none was found'
32
+ end
33
+
34
+ def self.details
35
+ <<~DETAILS
36
+ Uses `git describe --tags --abbrev=0 --match … --exclude …` to find the previous git tag
37
+ reachable from the current commit and that matches a specific naming pattern
38
+
39
+ e.g. `find_previous_tag(pattern: '12.3.*.*')`, `find_previous_tag(pattern: '12.3-rc-*')`
40
+ DETAILS
41
+ end
42
+
43
+ def self.available_options
44
+ [
45
+ FastlaneCore::ConfigItem.new(key: :pattern,
46
+ description: 'The _fnmatch_-style pattern to use when searching for the previous tag',
47
+ optional: true,
48
+ default_value: nil,
49
+ type: String),
50
+ ]
51
+ end
52
+
53
+ def self.is_supported?(platform)
54
+ true
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,112 @@
1
+ require 'fastlane/action'
2
+ require_relative '../../helper/github_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class GetPrsBetweenTagsAction < Action
7
+ def self.run(params)
8
+ repository = params[:repository]
9
+ tag_name = params[:tag_name]
10
+ target_commitish = params[:target_commitish]
11
+ previous_tag = params[:previous_tag]
12
+ config_file_path = params[:configuration_file_path]
13
+ gh_token = params[:github_token]
14
+
15
+ # Get commit list
16
+ github_helper = Fastlane::Helper::GithubHelper.new(github_token: gh_token)
17
+ changelog = begin
18
+ github_helper.generate_release_notes(
19
+ repository: repository,
20
+ tag_name: tag_name,
21
+ previous_tag: previous_tag,
22
+ target_commitish: target_commitish,
23
+ config_file_path: config_file_path
24
+ )
25
+ rescue StandardError => e
26
+ error_msg = "❌ Error computing the list of PRs since #{previous_tag || 'last release'}: `#{e.message}`"
27
+ UI.important(error_msg)
28
+ error_msg # Use error message as GitHub Release body to help us be aware of what went wrong.
29
+ end
30
+
31
+ previous_release_link = if previous_tag.nil?
32
+ 'last release'
33
+ else
34
+ link = github_helper.get_release_url(repository: repository, tag_name: previous_tag)
35
+ "[#{previous_tag}](#{link})"
36
+ end
37
+ changelog
38
+ .gsub("## What's Changed", "## New PRs since #{previous_release_link}\n")
39
+ end
40
+
41
+ def self.description
42
+ 'Gets a markdown text containing the list of PRs that have been merged between two git tags'
43
+ end
44
+
45
+ def self.authors
46
+ ['Automattic']
47
+ end
48
+
49
+ def self.return_value
50
+ 'The markdown-formatted string listing the PRs between the provided tags'
51
+ end
52
+
53
+ def self.details
54
+ <<~DETAILS
55
+ Uses the GitHub API to get a generated changelog consisting of the list of PRs that have been merged between two git tags.
56
+ The list of PRs can optionally be categorized using a config file (typically living at `.github/release.yml`)
57
+
58
+ This is typically useful to generate a CHANGELOG-style list of PRs for a given build since a last build. For example:
59
+
60
+ - List PRs between current beta that we just built (e.g. 12.3-rc-4) and the previous beta of the same version:
61
+ git_prs_between_tags(tag_name: '12.3-rc-4', previous_tag: '12.3-rc-3')
62
+ - List all PRs that landed since the last stable/final release:
63
+ git_prs_between_tags(tag_name: '12.3-rc-4', previous_tag: '12.2')
64
+
65
+ Tip: You can use the `find_previous_tag` action to help you find the previous_tag matching an expected pattern (like `12.3-rc-*`)
66
+
67
+ See https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release
68
+ DETAILS
69
+ end
70
+
71
+ def self.available_options
72
+ [
73
+ FastlaneCore::ConfigItem.new(key: :repository,
74
+ env_names: %w[GIT_REPO_SLUG BUILDKITE_REPO],
75
+ description: 'The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)',
76
+ optional: false,
77
+ default_value_dynamic: true,
78
+ type: String),
79
+ FastlaneCore::ConfigItem.new(key: :tag_name,
80
+ description: 'The name of the tag for the release we are about to create. This can be an existing tag or a new one',
81
+ optional: false,
82
+ type: String),
83
+ FastlaneCore::ConfigItem.new(key: :target_commitish,
84
+ description: 'Specifies the commitish value that will be the target for the release\'s tag. ' \
85
+ 'Required if the supplied `tag_name` does not reference an existing tag. Ignored if the tag_name already exists. ' \
86
+ 'Defaults to the commit sha of the current HEAD',
87
+ optional: true,
88
+ default_value: `git rev-parse HEAD`.chomp,
89
+ default_value_dynamic: true,
90
+ type: String),
91
+ FastlaneCore::ConfigItem.new(key: :previous_tag,
92
+ description: 'The name of the previous tag to use as the starting point for the release notes. ' \
93
+ 'If not provided explicitly, GitHub will use the last tag as the starting point',
94
+ optional: true,
95
+ type: String),
96
+ FastlaneCore::ConfigItem.new(key: :configuration_file_path,
97
+ description: 'Path to a file in the repository containing configuration settings used for generating the release notes. ' \
98
+ 'If unspecified, the configuration file located in the repository at `.github/release.yml` or `.github/release.yaml` will be used. ' \
99
+ 'If that is not present, the default configuration will be used. ' \
100
+ 'See https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options',
101
+ optional: true,
102
+ type: String),
103
+ Fastlane::Helper::GithubHelper.github_token_config_item,
104
+ ]
105
+ end
106
+
107
+ def self.is_supported?(platform)
108
+ true
109
+ end
110
+ end
111
+ end
112
+ end
@@ -25,11 +25,11 @@ module Fastlane
25
25
  downloader.download(loc[1], complete_url, loc[1] == params[:source_locale])
26
26
  end
27
27
 
28
- if loc.is_a?(String)
29
- UI.message "Downloading language: #{loc}"
30
- complete_url = "#{params[:project_url]}#{loc}/default/export-translations/?filters[status]=current&format=json"
31
- downloader.download(loc, complete_url, loc == params[:source_locale])
32
- end
28
+ next unless loc.is_a?(String)
29
+
30
+ UI.message "Downloading language: #{loc}"
31
+ complete_url = "#{params[:project_url]}#{loc}/default/export-translations/?filters[status]=current&format=json"
32
+ downloader.download(loc, complete_url, loc == params[:source_locale])
33
33
  end
34
34
  end
35
35
 
@@ -132,21 +132,21 @@ module Fastlane
132
132
  description: 'The path of the .po file to update',
133
133
  type: String,
134
134
  verify_block: proc do |value|
135
- UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
135
+ UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && !value.empty?
136
136
  UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
137
137
  end),
138
138
  FastlaneCore::ConfigItem.new(key: :release_version,
139
139
  env_name: 'FL_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
140
140
  description: 'The release version of the app (to use to mark the release notes)',
141
141
  verify_block: proc do |value|
142
- UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
142
+ UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && !value.empty?
143
143
  end),
144
144
  FastlaneCore::ConfigItem.new(key: :source_files,
145
145
  env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
146
146
  description: 'The hash with the path to the source files and the key to use to include their content',
147
147
  type: Hash,
148
148
  verify_block: proc do |value|
149
- UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
149
+ UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && !value.empty?
150
150
  end),
151
151
  ]
152
152
  end