fastlane-plugin-stream_actions 0.4.17 → 0.4.19

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: 46352486158d9628e7e172f2df0b4ab29f6b0ac575e66fd8fe8c92a014c43b42
4
- data.tar.gz: fad45a69555125e8bc8b55e026e47b1fb35348450abdcc0357c176c57a4ecd21
3
+ metadata.gz: cdaded0af171b644219f1ff21fbbc95ce49989a3ab0a1b4cd4ef005d2fb0bac4
4
+ data.tar.gz: 9a3fd47138ebe2038bee47ffd1d032ebca6eb90da13c0884196d19e6e6cbdfdf
5
5
  SHA512:
6
- metadata.gz: 9a5a36c1870b78a0764e92eaf5a6374b189df978c29b116815622cd123a5c48588408170265724c9601c2e607589ed5a1c93e8fcc012152d6ced161363511fa7
7
- data.tar.gz: 1f15575af4166ba23aa48d292bd0e1590a58b1094c8a3678235531af6727b8a384264f18f194c534555b0b47d91a72a8250f1c132dc762d012ad99fc0ac64f12
6
+ metadata.gz: 64bc765ced3b14f16c7c869116e43fcba25d2df49e028bdf323fe960ea6eefc7623bab5ae90422bb3d7304c52f82ccd87c78da5689aa7c7b00a0e311c442fc82
7
+ data.tar.gz: 6e6a18692206c35cc09f015ba51ac843af3538c2620127cdb04908a767a4f8f4e252536d28188537f8b2ff48c07c5d97d68541f43dac850ee94936ef27fb09f8
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  module Fastlane
2
4
  module Actions
3
5
  class PrCommentAction < Action
@@ -8,18 +10,53 @@ module Fastlane
8
10
  if params[:edit_last_comment_with_text]
9
11
  text = params[:edit_last_comment_with_text]
10
12
  UI.message("Checking last comment for required pattern: '#{text}'")
11
- comments = sh("gh api repos/#{params[:github_repo]}/issues/#{params[:pr_num]}/comments --jq " \
12
- "'[.[] | select(.body | test(\"#{text}\"; \"i\")) | {id, user: .user.login, html_url}]'")
13
+ comments = sh('gh', 'api', "repos/#{params[:github_repo]}/issues/#{params[:pr_num]}/comments",
14
+ print_command: false, print_command_output: false)
13
15
 
14
- JSON.parse(comments).each do |comment|
16
+ JSON.parse(comments).select { |comment| comment['body'].downcase.include?(text.downcase) }.each do |comment|
15
17
  sh("gh api --method DELETE repos/#{params[:github_repo]}/issues/comments/#{comment['id']}")
16
18
  end
17
19
  end
18
- sh("gh pr comment #{params[:pr_num]} -b '#{params[:text]}'")
20
+ Tempfile.create('pr_comment') do |file|
21
+ file.write(comment_body(params))
22
+ file.close
23
+ sh('gh', 'pr', 'comment', params[:pr_num].to_s, '--body-file', file.path)
24
+ end
19
25
  UI.success('PR comment has been added.')
20
26
  end
21
27
  end
22
28
 
29
+ def self.comment_body(params)
30
+ text = params[:text]
31
+ return text if text.length <= 65_536
32
+
33
+ UI.important("PR comment has #{text.length} characters, more than GitHub allows (65536). Full text:")
34
+ UI.message(text)
35
+ # Leave room for the closing fence and the footer
36
+ body = text[0, 60_000]
37
+ # Cut at a line break so a fence marker is never split
38
+ body = body[0, body.rindex("\n")] if body.include?("\n")
39
+ fence = open_fence(body)
40
+ body += "\n#{fence}" if fence
41
+ run_url = "https://github.com/#{params[:github_repo]}/actions/runs/#{ENV['GITHUB_RUN_ID']}"
42
+ "#{body}\n\n⚠️ Truncated to fit GitHub's comment limit. The full text is in the [job log](#{run_url})."
43
+ end
44
+
45
+ def self.open_fence(body)
46
+ fence = nil
47
+ body.each_line do |line|
48
+ marker = line[/\A {0,3}(`{3,})/, 1]
49
+ next unless marker
50
+
51
+ if fence.nil?
52
+ fence = marker
53
+ elsif marker.length >= fence.length && line.strip == marker
54
+ fence = nil
55
+ end
56
+ end
57
+ fence
58
+ end
59
+
23
60
  #####################################################
24
61
  # @!group Documentation
25
62
  #####################################################
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.17'
3
+ VERSION = '0.4.19'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.17
4
+ version: 0.4.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-22 00:00:00.000000000 Z
11
+ date: 2026-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list