fastlane-plugin-wpmreleasetoolkit 13.4.0 → 13.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ace179f7cf145c3a8bc0e2b9fa917eaa4654b93fcc9b329ef44013f227111420
4
- data.tar.gz: 1ddd2fe6be0810ec61a6089f44d60ff70599007cb1eb875de32c6df047cbfabe
3
+ metadata.gz: dfff41f7e06514a598cedc9d3815b0465bb543a26af079ac775812b4a689a614
4
+ data.tar.gz: 0d5c9349d56212cfa16fd9b731fcdc5318e23e12e5a1bdf7a23e3f8acf755783
5
5
  SHA512:
6
- metadata.gz: deba3263e74215fd1b98373940d2eb1b259eda28587e6a730446c596e1559b6a5ad74c3f7260e76d642e6b9ba57d1c5a43f5dd53f64b9d780c4f0400f4c3fc89
7
- data.tar.gz: 17bc9286fe256f21bcfa392bbd48a16d78c5130c1cb8191dc0931516695686eed42ba324a42155eb51a1f66eeefe74b8a44c79a8a24c612f7ad584d84af84f7f
6
+ metadata.gz: 84a281df90be326b5c1153a4a8ab27b55c8105169a50123537b86e2ca14ab0ff26e237b0f572941530a9b443f9d457c420fe80a46a1f1cf88baf6b862ef13e7f
7
+ data.tar.gz: d797602e89698606bb0c5f65d22cf469fff16341a503c5f3f97caef623fb36744252f770fe9df9018cff5c0b566ad8fd1787d4fe55aba07955c3bbf2013b2f3a
@@ -15,11 +15,35 @@ module Fastlane
15
15
  end
16
16
 
17
17
  class UploadBuildToAppsCdnAction < Action
18
+ # See https://github.a8c.com/Automattic/wpcom/blob/trunk/wp-content/lib/a8c/cdn/src/enums/enum-resource-type.php
18
19
  RESOURCE_TYPE = 'Build'
20
+ # These are from the WordPress.com API, not the Apps CDN plugin
19
21
  VALID_POST_STATUS = %w[publish draft].freeze
20
- VALID_BUILD_TYPES = %w[Alpha Beta Nightly Production Prototype].freeze
21
- VALID_PLATFORMS = ['Android', 'iOS', 'Mac - Silicon', 'Mac - Intel', 'Mac - Any', 'Windows'].freeze
22
- VALID_INSTALL_TYPES = ['Full Install', 'Update'].freeze
22
+ # See https://github.a8c.com/Automattic/wpcom/blob/trunk/wp-content/lib/a8c/cdn/src/enums/enum-build-type.php
23
+ VALID_BUILD_TYPES = %w[
24
+ Alpha
25
+ Beta
26
+ Nightly
27
+ Production
28
+ Prototype
29
+ ].freeze
30
+ # See https://github.a8c.com/Automattic/wpcom/blob/trunk/wp-content/lib/a8c/cdn/src/enums/enum-platform.php
31
+ VALID_PLATFORMS = [
32
+ 'Android',
33
+ 'iOS',
34
+ 'Mac - Silicon',
35
+ 'Mac - Intel',
36
+ 'Mac - Any',
37
+ 'Windows',
38
+ 'Microsoft Store',
39
+ ].freeze
40
+ # See https://github.a8c.com/Automattic/wpcom/blob/trunk/wp-content/lib/a8c/cdn/src/enums/enum-install-type.php
41
+ VALID_INSTALL_TYPES = [
42
+ 'Full Install',
43
+ 'Update',
44
+ ].freeze
45
+ # See https://github.a8c.com/Automattic/wpcom/blob/trunk/wp-content/lib/a8c/cdn/src/enums/enum-visibility.php
46
+ VALID_VISIBILITIES = %i[internal external].freeze
23
47
 
24
48
  def self.run(params)
25
49
  UI.message('Uploading build to Apps CDN...')
@@ -179,6 +203,8 @@ module Fastlane
179
203
  type: String,
180
204
  verify_block: proc do |value|
181
205
  UI.user_error!('Product cannot be empty') if value.to_s.empty?
206
+ # Unlike for other parameters, we don't validate the product value against a list of valid values because we expect this list of
207
+ # supported products to be updated on the backend from time to time and we don't want to have to update the toolkit every time for it.
182
208
  end
183
209
  ),
184
210
  FastlaneCore::ConfigItem.new(
@@ -228,7 +254,7 @@ module Fastlane
228
254
  optional: false,
229
255
  type: Symbol,
230
256
  verify_block: proc do |value|
231
- UI.user_error!('Visibility must be either :internal or :external') unless %i[internal external].include?(value)
257
+ UI.user_error!("Visibility must be one of: #{VALID_VISIBILITIES.map { "`:#{_1}`" }.join(', ')}") unless VALID_VISIBILITIES.include?(value.to_s.downcase.to_sym)
232
258
  end
233
259
  ),
234
260
  FastlaneCore::ConfigItem.new(
@@ -44,14 +44,42 @@ module Fastlane
44
44
  # @param [String] repository The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)
45
45
  # @param [Sawyer::Resource, String] milestone The milestone object, or title of the milestone, we want to fetch the list of PRs for (e.g.: `16.9`)
46
46
  # @param [Boolean] include_closed If set to true, will include both opened and closed PRs. Otherwise, will only include opened PRs.
47
- # @return [Array<Sawyer::Resource>] A list of the PRs for the given milestone, sorted by number
47
+ # @return [Array<Sawyer::Resource>] A list of the PRs and issues for the given milestone, sorted by number
48
48
  #
49
49
  def get_prs_and_issues_for_milestone(repository:, milestone:, include_closed: false)
50
+ # While the `/search` API used with a classic tokens returns both issues and PRs, using a fine-grained tokens always require either 'is:issue' or 'is:pull-request',
51
+ # therefore we need to make two separate calls to cover both cases
52
+ issues = search_milestone_items(repository: repository, milestone: milestone, type: :issue, include_closed: include_closed)
53
+ prs = search_milestone_items(repository: repository, milestone: milestone, type: :pr, include_closed: include_closed)
54
+
55
+ (issues + prs).sort_by(&:number)
56
+ end
57
+
58
+ # Search for issues or PRs for a given milestone
59
+ #
60
+ # @param [String] repository The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)
61
+ # @param [Sawyer::Resource, String] milestone The milestone object, or title of the milestone
62
+ # @param [Symbol] type The type of items to search for (:issue or :pr/:pull_request)
63
+ # @param [Boolean] include_closed If set to true, will include both opened and closed items. Otherwise, will only include opened items.
64
+ # @return [Array<Sawyer::Resource>] A list of issues or PRs for the given milestone
65
+ #
66
+ def search_milestone_items(repository:, milestone:, type:, include_closed: false)
50
67
  milestone_title = milestone.is_a?(Sawyer::Resource) ? milestone.title : milestone
51
- query = %(repo:#{repository} milestone:"#{milestone_title}")
68
+
69
+ # Map type symbol to GitHub search qualifier
70
+ type_qualifier = case type
71
+ when :issue
72
+ 'is:issue'
73
+ when :pr, :pull_request
74
+ 'is:pull-request'
75
+ else
76
+ raise ArgumentError, "Invalid type: #{type}. Must be :issue or :pr"
77
+ end
78
+
79
+ query = %(repo:#{repository} milestone:"#{milestone_title}" #{type_qualifier})
52
80
  query += ' is:open' unless include_closed
53
81
 
54
- client.search_issues(query)[:items].sort_by(&:number)
82
+ client.search_issues(query)[:items]
55
83
  end
56
84
 
57
85
  # Set/Update the milestone assigned to a given PR or issue
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module Wpmreleasetoolkit
5
- VERSION = '13.4.0'
5
+ VERSION = '13.5.1'
6
6
  end
7
7
  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: 13.4.0
4
+ version: 13.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Automattic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-05 00:00:00.000000000 Z
11
+ date: 2025-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport