fastlane-plugin-stream_actions 0.3.93 → 0.3.94
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a5a2923c5b1d82d4317903160697b17155f1994ecddd28cff49c25ad0bd55a
|
4
|
+
data.tar.gz: 69d56018e538008e9c9240373e5d4bfcaf0d04585baaf4e1c00a981a4b535dc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 905601f4a4cec4c236f9a6638a7e96ed83d4b0858f12a64ddb65febf621f44c06e2f1af9b42077c7b8ac2f26ea04f39a5a29243f8792d96464d4d064df5b975c
|
7
|
+
data.tar.gz: 4beb10e77c0df972b27366af49ad5ca3fee7c922bb801cc93b57d25c65cda51484c68f93a952c75cc8dc5639cdb58e47e5897ce0def27a52191db33149411129
|
@@ -2,24 +2,21 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class PrCommentAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
if params[:pr_num].to_s.empty?
|
6
|
-
UI.important('Skipping the PR comment.')
|
5
|
+
if params[:pr_num].to_s.empty? || params[:github_repo].to_s.empty?
|
6
|
+
UI.important('Skipping the PR comment because PR number or GitHub repo is not set.')
|
7
7
|
else
|
8
|
-
additional_args = []
|
9
8
|
if params[:edit_last_comment_with_text]
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
text = params[:edit_last_comment_with_text]
|
10
|
+
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}]'")
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
else
|
18
|
-
UI.important('Last comment does not match the pattern.')
|
14
|
+
JSON.parse(comments).each do |comment|
|
15
|
+
sh("gh api --method DELETE repos/#{params[:github_repo]}/issues/comments/#{comment['id']}")
|
19
16
|
end
|
20
17
|
end
|
21
|
-
sh("gh pr comment #{params[:pr_num]} -b '#{params[:text]}'
|
22
|
-
UI.success('PR comment been added.')
|
18
|
+
sh("gh pr comment #{params[:pr_num]} -b '#{params[:text]}'")
|
19
|
+
UI.success('PR comment has been added.')
|
23
20
|
end
|
24
21
|
end
|
25
22
|
|
@@ -33,6 +30,12 @@ module Fastlane
|
|
33
30
|
|
34
31
|
def self.available_options
|
35
32
|
[
|
33
|
+
FastlaneCore::ConfigItem.new(
|
34
|
+
env_name: 'GITHUB_REPOSITORY',
|
35
|
+
key: :github_repo,
|
36
|
+
description: 'GitHub repo name',
|
37
|
+
optional: true
|
38
|
+
),
|
36
39
|
FastlaneCore::ConfigItem.new(
|
37
40
|
env_name: 'GITHUB_PR_NUM',
|
38
41
|
key: :pr_num,
|
@@ -49,7 +52,7 @@ module Fastlane
|
|
49
52
|
),
|
50
53
|
FastlaneCore::ConfigItem.new(
|
51
54
|
key: :edit_last_comment_with_text,
|
52
|
-
description: 'If last comment contains this text it will be edited',
|
55
|
+
description: 'If last comment contains this text it will be edited or replaced',
|
53
56
|
is_string: true,
|
54
57
|
optional: true
|
55
58
|
)
|