fastlane-plugin-stream_actions 0.4.17 → 0.4.18

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: 88f3fccde6a70f7e9a9404511d247b2d9362d0f76357bc7f664b63a0abc8329a
4
+ data.tar.gz: '0893253baa0422ce6c25844f256c1ac2fcaac3031d9cc5f48dba08ff56658c1b'
5
5
  SHA512:
6
- metadata.gz: 9a5a36c1870b78a0764e92eaf5a6374b189df978c29b116815622cd123a5c48588408170265724c9601c2e607589ed5a1c93e8fcc012152d6ced161363511fa7
7
- data.tar.gz: 1f15575af4166ba23aa48d292bd0e1590a58b1094c8a3678235531af6727b8a384264f18f194c534555b0b47d91a72a8250f1c132dc762d012ad99fc0ac64f12
6
+ metadata.gz: ebade8a7f1ac5aac41fb5f3b0d0208dd3918c970889add9abb9d4d8541e4248431256c1ef0eaeecee7705d0f2b6317923e7c4338108b502487b921d5d32243b8
7
+ data.tar.gz: 9ebc3f1b2cfeaf82b0b821e1de032e670be5bdba3b4e26bb5766c03c5003637e38c493d9296ca30408b8c9a1038746740d3c50546a9ea5985503a142304caaef
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  module Fastlane
2
4
  module Actions
3
5
  class PrCommentAction < Action
@@ -8,18 +10,52 @@ 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", log: false)
13
14
 
14
- JSON.parse(comments).each do |comment|
15
+ JSON.parse(comments).select { |comment| comment['body'].downcase.include?(text.downcase) }.each do |comment|
15
16
  sh("gh api --method DELETE repos/#{params[:github_repo]}/issues/comments/#{comment['id']}")
16
17
  end
17
18
  end
18
- sh("gh pr comment #{params[:pr_num]} -b '#{params[:text]}'")
19
+ Tempfile.create('pr_comment') do |file|
20
+ file.write(comment_body(params))
21
+ file.close
22
+ sh('gh', 'pr', 'comment', params[:pr_num].to_s, '--body-file', file.path)
23
+ end
19
24
  UI.success('PR comment has been added.')
20
25
  end
21
26
  end
22
27
 
28
+ def self.comment_body(params)
29
+ text = params[:text]
30
+ return text if text.length <= 65_536
31
+
32
+ UI.important("PR comment has #{text.length} characters, more than GitHub allows (65536). Full text:")
33
+ UI.message(text)
34
+ # Leave room for the closing fence and the footer
35
+ body = text[0, 60_000]
36
+ # Cut at a line break so a fence marker is never split
37
+ body = body[0, body.rindex("\n")] if body.include?("\n")
38
+ fence = open_fence(body)
39
+ body += "\n#{fence}" if fence
40
+ run_url = "https://github.com/#{params[:github_repo]}/actions/runs/#{ENV['GITHUB_RUN_ID']}"
41
+ "#{body}\n\n⚠️ Truncated to fit GitHub's comment limit. The full text is in the [job log](#{run_url})."
42
+ end
43
+
44
+ def self.open_fence(body)
45
+ fence = nil
46
+ body.each_line do |line|
47
+ marker = line[/\A {0,3}(`{3,})/, 1]
48
+ next unless marker
49
+
50
+ if fence.nil?
51
+ fence = marker
52
+ elsif marker.length >= fence.length && line.strip == marker
53
+ fence = nil
54
+ end
55
+ end
56
+ fence
57
+ end
58
+
23
59
  #####################################################
24
60
  # @!group Documentation
25
61
  #####################################################
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.4.17'
3
+ VERSION = '0.4.18'
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.18
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