fastlane-plugin-wpmreleasetoolkit 13.5.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: d022bdc136add014c305e7d06dee672e4cd9bb34bcac77ccef7a876f54597c9d
4
- data.tar.gz: 92bee8e4989223907a6f2e8c8e733219ffba191c49a756e01e60dbbe95a3c913
3
+ metadata.gz: dfff41f7e06514a598cedc9d3815b0465bb543a26af079ac775812b4a689a614
4
+ data.tar.gz: 0d5c9349d56212cfa16fd9b731fcdc5318e23e12e5a1bdf7a23e3f8acf755783
5
5
  SHA512:
6
- metadata.gz: 690c4f8a452cceda096e4dc9f3667e9a2fbb44c67f7377a58ba1267f1aa7753c3403cabc279e6f28cc2d4b9ba4da43162433dd14034f944001e6b4038d164595
7
- data.tar.gz: 669a524c570d9704139a297c54469acfdd86c41da83b1e6754b693e98b27afd24805328199cbe8f449d71e10c7588db12df636c8b08bad8bb86da3b1527a832e
6
+ metadata.gz: 84a281df90be326b5c1153a4a8ab27b55c8105169a50123537b86e2ca14ab0ff26e237b0f572941530a9b443f9d457c420fe80a46a1f1cf88baf6b862ef13e7f
7
+ data.tar.gz: d797602e89698606bb0c5f65d22cf469fff16341a503c5f3f97caef623fb36744252f770fe9df9018cff5c0b566ad8fd1787d4fe55aba07955c3bbf2013b2f3a
@@ -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.5.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.5.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-09-19 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