fastlane-plugin-stream_actions 0.4.1 → 0.4.2

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: 98ea1940f8aa3135975f332a499eb1d755e31f01c5d5bedb28f19d807fd164ea
4
- data.tar.gz: c583a39f54b3acc092486c66877c9453bd6fb9e2b0013b02bad309e9e7165c33
3
+ metadata.gz: 5db13e6770f55566dab3812ca6cc13d72a4cfbf55a12c105fd7fd46da6fafa7a
4
+ data.tar.gz: 9066d128357a6b2513f3d395246d9c4ec7b9c5bfe7dd52d9cdb54a3a98432e7a
5
5
  SHA512:
6
- metadata.gz: ecdaab8fb0a7311bdd636132be1ee212c60d40935df5787a3d13c6284dd262c6274310995f73119f5bf14993ea34ca154b1979240452902299f9a31b648bc0bc
7
- data.tar.gz: 204c24b4512c844608a14e7555de811fd8c20f4a40084548c1fe975c0dca6e229bbe29d2cbbf43a58d101149157ef4744ab9f92502c4c780c2754d693ade5b8a
6
+ metadata.gz: d916b54cef7c5304f0ec2467fa27e6426f1696212f3b6f857a74b674a04343e4042d0b39736dc30ef1031c487fb78cc3328c0041111405c3f5fd4902adb0c68f
7
+ data.tar.gz: 6c0239be3c703aa18bea7fe0b033c065a776c1e6e8ca1d26dd2d6b8e0bbb8648fee9cc4f6394042d3478d110a32702527f28edf43cd638ddc7643f71cd55485d
@@ -0,0 +1,49 @@
1
+ module Fastlane
2
+ module Actions
3
+ class NextPrNumberAction < Action
4
+ def self.run(params)
5
+ uri = URI('https://api.github.com/repos')
6
+ uri.path += "/#{params[:github_repo]}/issues"
7
+ uri.query = URI.encode_www_form('state' => 'all', 'sort' => 'created', 'direction' => 'desc', 'per_page' => 1)
8
+
9
+ http = Net::HTTP.new(uri.host, uri.port)
10
+ http.use_ssl = true
11
+ request = Net::HTTP::Get.new(uri.request_uri)
12
+ token = ENV.fetch('GITHUB_TOKEN') { nil }
13
+ token = ENV.fetch('GH_TOKEN') { nil } if token.to_s.empty?
14
+ request['Authorization'] = "Bearer #{token}" unless token.to_s.empty?
15
+
16
+ response = http.request(request)
17
+ UI.user_error!("GitHub API request failed: #{response.code} #{response.message} — body: #{response.body}") if response.code != '200'
18
+
19
+ list = JSON.parse(response.body)
20
+ max_num = list.empty? ? 0 : list[0]['number'].to_i
21
+ next_num = max_num + 1
22
+ UI.important("Next pull request number: #{next_num}")
23
+ next_num
24
+ end
25
+
26
+ #####################################################
27
+ # @!group Documentation
28
+ #####################################################
29
+
30
+ def self.description
31
+ 'Get next pull request number'
32
+ end
33
+
34
+ def self.available_options
35
+ [
36
+ FastlaneCore::ConfigItem.new(
37
+ key: :github_repo,
38
+ env_name: 'GITHUB_REPOSITORY',
39
+ description: 'GitHub repo name'
40
+ )
41
+ ]
42
+ end
43
+
44
+ def self.is_supported?(platform)
45
+ [:ios].include?(platform)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -22,7 +22,6 @@ module Fastlane
22
22
  [
23
23
  FastlaneCore::ConfigItem.new(
24
24
  key: :version,
25
- env_name: 'GITHUB_REPOSITORY',
26
25
  description: 'Xcode version'
27
26
  )
28
27
  ]
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
@@ -242,6 +242,7 @@ files:
242
242
  - lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
243
243
  - lib/fastlane/plugin/stream_actions/actions/merge_main_to_develop.rb
244
244
  - lib/fastlane/plugin/stream_actions/actions/merge_release_to_main.rb
245
+ - lib/fastlane/plugin/stream_actions/actions/next_pr_number.rb
245
246
  - lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb
246
247
  - lib/fastlane/plugin/stream_actions/actions/pr_comment.rb
247
248
  - lib/fastlane/plugin/stream_actions/actions/pr_create.rb