fastlane 2.180.1 → 2.181.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -90
- data/fastlane/lib/fastlane/actions/clipboard.rb +3 -6
- data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +2 -6
- data/fastlane/lib/fastlane/actions/git_branch.rb +1 -1
- data/fastlane/lib/fastlane/actions/slack.rb +148 -127
- data/fastlane/lib/fastlane/helper/git_helper.rb +9 -1
- data/fastlane/lib/fastlane/lane_manager.rb +3 -2
- data/fastlane/lib/fastlane/version.rb +1 -1
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/DeliverfileProtocol.swift +1 -1
- data/fastlane/swift/Fastlane.swift +5 -5
- data/fastlane/swift/Gymfile.swift +1 -1
- data/fastlane/swift/GymfileProtocol.swift +1 -1
- data/fastlane/swift/Matchfile.swift +1 -1
- data/fastlane/swift/MatchfileProtocol.swift +1 -1
- data/fastlane/swift/Precheckfile.swift +1 -1
- data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
- data/fastlane/swift/Scanfile.swift +1 -1
- data/fastlane/swift/ScanfileProtocol.swift +1 -1
- data/fastlane/swift/Screengrabfile.swift +1 -1
- data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
- data/fastlane/swift/Snapshotfile.swift +1 -1
- data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
- data/fastlane/swift/formatting/Brewfile.lock.json +10 -8
- data/fastlane_core/lib/fastlane_core.rb +22 -21
- data/fastlane_core/lib/fastlane_core/build_watcher.rb +50 -9
- data/fastlane_core/lib/fastlane_core/clipboard.rb +20 -0
- data/gym/lib/gym/runner.rb +5 -1
- data/scan/lib/scan/runner.rb +2 -0
- data/scan/lib/scan/test_command_generator.rb +3 -1
- data/snapshot/lib/snapshot/reports_generator.rb +4 -0
- data/spaceship/README.md +2 -12
- data/spaceship/lib/spaceship/commands_generator.rb +2 -1
- data/spaceship/lib/spaceship/spaceauth_runner.rb +19 -9
- data/spaceship/lib/spaceship/tunes/members.rb +1 -1
- data/supply/lib/supply/client.rb +3 -1
- data/supply/lib/supply/options.rb +2 -2
- data/supply/lib/supply/uploader.rb +1 -0
- metadata +21 -22
- data/fastlane/lib/fastlane/.fastlane_require.rb.swp +0 -0
- data/fastlane/lib/fastlane/actions/.cocoapods.rb.swp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38bb5919faa63d99767d24690442b21a5d481b03afe68a1832e4d3d1a4e28e29
|
4
|
+
data.tar.gz: 5553432685d7e0474eec0b6a76e932834ae0afd741f0ac02af7e1ec2b755af80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6db2341264725bb9af7c225cacd888a044949311402de5d9cd0c917a73ffcccf4627adee7d160a1fe46e1e150d855dbd41951b0d50a06dd97fc27f8b78888f
|
7
|
+
data.tar.gz: 384e80ffe1b82abd1b84b2f09e7367da9e8cfbf5ce2427ccb61b62b738a1b91ff5091da839afc23d7ddec123d16d0e3ff8f3186eef3fc41b9e547a7a685b63e4
|
data/README.md
CHANGED
@@ -35,49 +35,55 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
|
|
35
35
|
<!-- This table is regenerated and resorted on each release -->
|
36
36
|
<table id='team'>
|
37
37
|
<tr>
|
38
|
-
<td id='
|
39
|
-
<a href='https://github.com/
|
40
|
-
<img src='https://github.com/
|
38
|
+
<td id='matthew-ellis'>
|
39
|
+
<a href='https://github.com/matthewellis'>
|
40
|
+
<img src='https://github.com/matthewellis.png?size=140'>
|
41
41
|
</a>
|
42
|
-
<h4 align='center'><a href='https://twitter.com/
|
42
|
+
<h4 align='center'><a href='https://twitter.com/mellis1995'>Matthew Ellis</a></h4>
|
43
43
|
</td>
|
44
|
-
<td id='
|
45
|
-
<a href='https://github.com/
|
46
|
-
<img src='https://github.com/
|
44
|
+
<td id='danielle-tomlinson'>
|
45
|
+
<a href='https://github.com/endocrimes'>
|
46
|
+
<img src='https://github.com/endocrimes.png?size=140'>
|
47
47
|
</a>
|
48
|
-
<h4 align='center'><a href='https://twitter.com/
|
48
|
+
<h4 align='center'><a href='https://twitter.com/endocrimes'>Danielle Tomlinson</a></h4>
|
49
49
|
</td>
|
50
|
-
<td id='
|
51
|
-
<a href='https://github.com/
|
52
|
-
<img src='https://github.com/
|
50
|
+
<td id='satoshi-namai'>
|
51
|
+
<a href='https://github.com/ainame'>
|
52
|
+
<img src='https://github.com/ainame.png?size=140'>
|
53
53
|
</a>
|
54
|
-
<h4 align='center'><a href='https://twitter.com/
|
54
|
+
<h4 align='center'><a href='https://twitter.com/ainame'>Satoshi Namai</a></h4>
|
55
55
|
</td>
|
56
|
-
<td id='
|
57
|
-
<a href='https://github.com/
|
58
|
-
<img src='https://github.com/
|
56
|
+
<td id='olivier-halligon'>
|
57
|
+
<a href='https://github.com/AliSoftware'>
|
58
|
+
<img src='https://github.com/AliSoftware.png?size=140'>
|
59
59
|
</a>
|
60
|
-
<h4 align='center'><a href='https://twitter.com/
|
60
|
+
<h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
|
61
|
+
</td>
|
62
|
+
<td id='max-ott'>
|
63
|
+
<a href='https://github.com/max-ott'>
|
64
|
+
<img src='https://github.com/max-ott.png?size=140'>
|
65
|
+
</a>
|
66
|
+
<h4 align='center'><a href='https://twitter.com/ott_max'>Max Ott</a></h4>
|
61
67
|
</td>
|
68
|
+
</tr>
|
69
|
+
<tr>
|
62
70
|
<td id='maksym-grebenets'>
|
63
71
|
<a href='https://github.com/mgrebenets'>
|
64
72
|
<img src='https://github.com/mgrebenets.png?size=140'>
|
65
73
|
</a>
|
66
74
|
<h4 align='center'><a href='https://twitter.com/mgrebenets'>Maksym Grebenets</a></h4>
|
67
75
|
</td>
|
68
|
-
|
69
|
-
<
|
70
|
-
<
|
71
|
-
<a href='https://github.com/nafu'>
|
72
|
-
<img src='https://github.com/nafu.png?size=140'>
|
76
|
+
<td id='felix-krause'>
|
77
|
+
<a href='https://github.com/KrauseFx'>
|
78
|
+
<img src='https://github.com/KrauseFx.png?size=140'>
|
73
79
|
</a>
|
74
|
-
<h4 align='center'><a href='https://twitter.com/
|
80
|
+
<h4 align='center'><a href='https://twitter.com/KrauseFx'>Felix Krause</a></h4>
|
75
81
|
</td>
|
76
|
-
<td id='
|
77
|
-
<a href='https://github.com/
|
78
|
-
<img src='https://github.com/
|
82
|
+
<td id='iulian-onofrei'>
|
83
|
+
<a href='https://github.com/revolter'>
|
84
|
+
<img src='https://github.com/revolter.png?size=140'>
|
79
85
|
</a>
|
80
|
-
<h4 align='center'><a href='https://twitter.com/
|
86
|
+
<h4 align='center'><a href='https://twitter.com/Revolt666'>Iulian Onofrei</a></h4>
|
81
87
|
</td>
|
82
88
|
<td id='luka-mirosevic'>
|
83
89
|
<a href='https://github.com/lmirosevic'>
|
@@ -85,37 +91,19 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
|
|
85
91
|
</a>
|
86
92
|
<h4 align='center'><a href='https://twitter.com/lmirosevic'>Luka Mirosevic</a></h4>
|
87
93
|
</td>
|
88
|
-
<td id='
|
89
|
-
<a href='https://github.com/
|
90
|
-
<img src='https://github.com/
|
91
|
-
</a>
|
92
|
-
<h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
|
93
|
-
</td>
|
94
|
-
<td id='satoshi-namai'>
|
95
|
-
<a href='https://github.com/ainame'>
|
96
|
-
<img src='https://github.com/ainame.png?size=140'>
|
94
|
+
<td id='fumiya-nakamura'>
|
95
|
+
<a href='https://github.com/nafu'>
|
96
|
+
<img src='https://github.com/nafu.png?size=140'>
|
97
97
|
</a>
|
98
|
-
<h4 align='center'><a href='https://twitter.com/
|
98
|
+
<h4 align='center'><a href='https://twitter.com/nafu003'>Fumiya Nakamura</a></h4>
|
99
99
|
</td>
|
100
100
|
</tr>
|
101
101
|
<tr>
|
102
|
-
<td id='
|
103
|
-
<a href='https://github.com/
|
104
|
-
<img src='https://github.com/
|
105
|
-
</a>
|
106
|
-
<h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
|
107
|
-
</td>
|
108
|
-
<td id='olivier-halligon'>
|
109
|
-
<a href='https://github.com/AliSoftware'>
|
110
|
-
<img src='https://github.com/AliSoftware.png?size=140'>
|
111
|
-
</a>
|
112
|
-
<h4 align='center'><a href='https://twitter.com/aligatr'>Olivier Halligon</a></h4>
|
113
|
-
</td>
|
114
|
-
<td id='roger-oba'>
|
115
|
-
<a href='https://github.com/rogerluan'>
|
116
|
-
<img src='https://github.com/rogerluan.png?size=140'>
|
102
|
+
<td id='jorge-revuelta-h'>
|
103
|
+
<a href='https://github.com/minuscorp'>
|
104
|
+
<img src='https://github.com/minuscorp.png?size=140'>
|
117
105
|
</a>
|
118
|
-
<h4 align='center'><a href='https://twitter.com/
|
106
|
+
<h4 align='center'><a href='https://twitter.com/minuscorp'>Jorge Revuelta H</a></h4>
|
119
107
|
</td>
|
120
108
|
<td id='manu-wallner'>
|
121
109
|
<a href='https://github.com/milch'>
|
@@ -123,37 +111,43 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
|
|
123
111
|
</a>
|
124
112
|
<h4 align='center'><a href='https://twitter.com/acrooow'>Manu Wallner</a></h4>
|
125
113
|
</td>
|
126
|
-
<td id='
|
127
|
-
<a href='https://github.com/
|
128
|
-
<img src='https://github.com/
|
114
|
+
<td id='daniel-jankowski'>
|
115
|
+
<a href='https://github.com/mollyIV'>
|
116
|
+
<img src='https://github.com/mollyIV.png?size=140'>
|
129
117
|
</a>
|
130
|
-
<h4 align='center'><a href='https://twitter.com/
|
118
|
+
<h4 align='center'><a href='https://twitter.com/mollyIV'>Daniel Jankowski</a></h4>
|
131
119
|
</td>
|
132
|
-
|
133
|
-
<
|
134
|
-
<
|
135
|
-
<a href='https://github.com/hjanuschka'>
|
136
|
-
<img src='https://github.com/hjanuschka.png?size=140'>
|
120
|
+
<td id='jérôme-lacoste'>
|
121
|
+
<a href='https://github.com/lacostej'>
|
122
|
+
<img src='https://github.com/lacostej.png?size=140'>
|
137
123
|
</a>
|
138
|
-
<h4 align='center'><a href='https://twitter.com/
|
124
|
+
<h4 align='center'><a href='https://twitter.com/lacostej'>Jérôme Lacoste</a></h4>
|
139
125
|
</td>
|
140
|
-
<td id='
|
141
|
-
<a href='https://github.com/
|
142
|
-
<img src='https://github.com/
|
126
|
+
<td id='aaron-brager'>
|
127
|
+
<a href='https://github.com/getaaron'>
|
128
|
+
<img src='https://github.com/getaaron.png?size=140'>
|
143
129
|
</a>
|
144
|
-
<h4 align='center'>
|
130
|
+
<h4 align='center'><a href='https://twitter.com/getaaron'>Aaron Brager</a></h4>
|
145
131
|
</td>
|
146
|
-
|
147
|
-
<
|
148
|
-
<
|
132
|
+
</tr>
|
133
|
+
<tr>
|
134
|
+
<td id='jan-piotrowski'>
|
135
|
+
<a href='https://github.com/janpio'>
|
136
|
+
<img src='https://github.com/janpio.png?size=140'>
|
149
137
|
</a>
|
150
|
-
<h4 align='center'><a href='https://twitter.com/
|
138
|
+
<h4 align='center'><a href='https://twitter.com/Sujan'>Jan Piotrowski</a></h4>
|
151
139
|
</td>
|
152
|
-
<td id='
|
153
|
-
<a href='https://github.com/
|
154
|
-
<img src='https://github.com/
|
140
|
+
<td id='andrew-mcburney'>
|
141
|
+
<a href='https://github.com/armcburney'>
|
142
|
+
<img src='https://github.com/armcburney.png?size=140'>
|
155
143
|
</a>
|
156
|
-
<h4 align='center'><a href='https://twitter.com/
|
144
|
+
<h4 align='center'><a href='https://twitter.com/armcburney'>Andrew McBurney</a></h4>
|
145
|
+
</td>
|
146
|
+
<td id='joshua-liebowitz'>
|
147
|
+
<a href='https://github.com/taquitos'>
|
148
|
+
<img src='https://github.com/taquitos.png?size=140'>
|
149
|
+
</a>
|
150
|
+
<h4 align='center'><a href='https://twitter.com/taquitos'>Joshua Liebowitz</a></h4>
|
157
151
|
</td>
|
158
152
|
<td id='stefan-natchev'>
|
159
153
|
<a href='https://github.com/snatchev'>
|
@@ -161,31 +155,37 @@ If the above doesn't help, please [submit an issue](https://github.com/fastlane/
|
|
161
155
|
</a>
|
162
156
|
<h4 align='center'><a href='https://twitter.com/snatchev'>Stefan Natchev</a></h4>
|
163
157
|
</td>
|
158
|
+
<td id='josh-holtz'>
|
159
|
+
<a href='https://github.com/joshdholtz'>
|
160
|
+
<img src='https://github.com/joshdholtz.png?size=140'>
|
161
|
+
</a>
|
162
|
+
<h4 align='center'><a href='https://twitter.com/joshdholtz'>Josh Holtz</a></h4>
|
163
|
+
</td>
|
164
164
|
</tr>
|
165
165
|
<tr>
|
166
|
-
<td id='
|
167
|
-
<a href='https://github.com/
|
168
|
-
<img src='https://github.com/
|
166
|
+
<td id='jimmy-dee'>
|
167
|
+
<a href='https://github.com/jdee'>
|
168
|
+
<img src='https://github.com/jdee.png?size=140'>
|
169
169
|
</a>
|
170
|
-
<h4 align='center'
|
170
|
+
<h4 align='center'>Jimmy Dee</h4>
|
171
171
|
</td>
|
172
|
-
<td id='
|
173
|
-
<a href='https://github.com/
|
174
|
-
<img src='https://github.com/
|
172
|
+
<td id='kohki-miki'>
|
173
|
+
<a href='https://github.com/giginet'>
|
174
|
+
<img src='https://github.com/giginet.png?size=140'>
|
175
175
|
</a>
|
176
|
-
<h4 align='center'><a href='https://twitter.com/
|
176
|
+
<h4 align='center'><a href='https://twitter.com/giginet'>Kohki Miki</a></h4>
|
177
177
|
</td>
|
178
|
-
<td id='
|
179
|
-
<a href='https://github.com/
|
180
|
-
<img src='https://github.com/
|
178
|
+
<td id='roger-oba'>
|
179
|
+
<a href='https://github.com/rogerluan'>
|
180
|
+
<img src='https://github.com/rogerluan.png?size=140'>
|
181
181
|
</a>
|
182
|
-
<h4 align='center'><a href='https://twitter.com/
|
182
|
+
<h4 align='center'><a href='https://twitter.com/rogerluan_'>Roger Oba</a></h4>
|
183
183
|
</td>
|
184
|
-
<td id='
|
185
|
-
<a href='https://github.com/
|
186
|
-
<img src='https://github.com/
|
184
|
+
<td id='helmut-januschka'>
|
185
|
+
<a href='https://github.com/hjanuschka'>
|
186
|
+
<img src='https://github.com/hjanuschka.png?size=140'>
|
187
187
|
</a>
|
188
|
-
<h4 align='center'><a href='https://twitter.com/
|
188
|
+
<h4 align='center'><a href='https://twitter.com/hjanuschka'>Helmut Januschka</a></h4>
|
189
189
|
</td>
|
190
190
|
</table>
|
191
191
|
|
@@ -7,10 +7,7 @@ module Fastlane
|
|
7
7
|
truncated_value = value[0..800].gsub(/\s\w+\s*$/, '...')
|
8
8
|
UI.message("Storing '#{truncated_value}' in the clipboard 🎨")
|
9
9
|
|
10
|
-
|
11
|
-
require 'open3'
|
12
|
-
Open3.popen3('pbcopy') { |input, _, _| input << value }
|
13
|
-
end
|
10
|
+
FastlaneCore::Clipboard.copy(content: value)
|
14
11
|
end
|
15
12
|
|
16
13
|
#####################################################
|
@@ -30,11 +27,11 @@ module Fastlane
|
|
30
27
|
end
|
31
28
|
|
32
29
|
def self.authors
|
33
|
-
["KrauseFx", "joshdholtz"]
|
30
|
+
["KrauseFx", "joshdholtz", "rogerluan"]
|
34
31
|
end
|
35
32
|
|
36
33
|
def self.is_supported?(platform)
|
37
|
-
|
34
|
+
FastlaneCore::Clipboard.is_supported?
|
38
35
|
end
|
39
36
|
|
40
37
|
def self.example_code
|
@@ -3,15 +3,11 @@ module Fastlane
|
|
3
3
|
class EnsureEnvVarsAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
variables = params[:env_vars]
|
6
|
+
missing_variables = variables.select { |variable| ENV[variable].to_s.strip.empty? }
|
6
7
|
|
7
|
-
|
8
|
-
next unless ENV[variable].to_s.strip.empty?
|
9
|
-
|
10
|
-
UI.user_error!("Missing environment variable '#{variable}'")
|
11
|
-
end
|
8
|
+
UI.user_error!("Missing environment variable(s) '#{missing_variables.join('\', \'')}'") unless missing_variables.empty?
|
12
9
|
|
13
10
|
is_one = variables.length == 1
|
14
|
-
|
15
11
|
UI.success("Environment variable#{is_one ? '' : 's'} '#{variables.join('\', \'')}' #{is_one ? 'is' : 'are'} set!")
|
16
12
|
end
|
17
13
|
|
@@ -2,7 +2,7 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class GitBranchAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
branch = Actions.git_branch
|
5
|
+
branch = Actions.git_branch || ""
|
6
6
|
return "" if branch == "HEAD" # Backwards compatibility with the original (and documented) implementation
|
7
7
|
branch
|
8
8
|
end
|
@@ -4,49 +4,40 @@
|
|
4
4
|
module Fastlane
|
5
5
|
module Actions
|
6
6
|
class SlackAction < Action
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# As there is a text limit in the notifications, we are
|
12
|
-
# usually interested in the last part of the message
|
13
|
-
# e.g. for tests
|
14
|
-
def self.trim_message(message)
|
15
|
-
# We want the last 7000 characters, instead of the first 7000, as the error is at the bottom
|
16
|
-
start_index = [message.length - 7000, 0].max
|
17
|
-
message = message[start_index..-1]
|
18
|
-
# We want line breaks to be shown on slack output so we replace
|
19
|
-
# input non-interpreted line break with interpreted line break
|
20
|
-
message.gsub('\n', "\n")
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.run(options)
|
24
|
-
require 'slack-notifier'
|
25
|
-
|
26
|
-
options[:message] = self.trim_message(options[:message].to_s || '')
|
27
|
-
options[:message] = Slack::Notifier::Util::LinkFormatter.format(options[:message])
|
28
|
-
|
29
|
-
options[:pretext] = options[:pretext].gsub('\n', "\n") unless options[:pretext].nil?
|
30
|
-
|
31
|
-
if options[:channel].to_s.length > 0
|
32
|
-
channel = options[:channel]
|
33
|
-
channel = ('#' + options[:channel]) unless ['#', '@'].include?(channel[0]) # send message to channel by default
|
7
|
+
class Runner
|
8
|
+
def initialize(slack_url)
|
9
|
+
@notifier = Slack::Notifier.new(slack_url)
|
34
10
|
end
|
35
11
|
|
36
|
-
|
12
|
+
def run(options)
|
13
|
+
options[:message] = self.class.trim_message(options[:message].to_s || '')
|
14
|
+
options[:message] = Slack::Notifier::Util::LinkFormatter.format(options[:message])
|
37
15
|
|
38
|
-
|
16
|
+
options[:pretext] = options[:pretext].gsub('\n', "\n") unless options[:pretext].nil?
|
39
17
|
|
40
|
-
|
18
|
+
if options[:channel].to_s.length > 0
|
19
|
+
channel = options[:channel]
|
20
|
+
channel = ('#' + options[:channel]) unless ['#', '@'].include?(channel[0]) # send message to channel by default
|
21
|
+
end
|
41
22
|
|
42
|
-
|
23
|
+
username = options[:use_webhook_configured_username_and_icon] ? nil : options[:username]
|
43
24
|
|
44
|
-
|
25
|
+
slack_attachment = self.class.generate_slack_attachments(options)
|
26
|
+
link_names = options[:link_names]
|
27
|
+
icon_url = options[:use_webhook_configured_username_and_icon] ? nil : options[:icon_url]
|
45
28
|
|
46
|
-
|
29
|
+
post_message(
|
30
|
+
channel: channel,
|
31
|
+
username: username,
|
32
|
+
attachments: [slack_attachment],
|
33
|
+
link_names: link_names,
|
34
|
+
icon_url: icon_url,
|
35
|
+
fail_on_error: options[:fail_on_error]
|
36
|
+
)
|
37
|
+
end
|
47
38
|
|
48
|
-
|
49
|
-
results = notifier.ping('', link_names: link_names, icon_url: icon_url, attachments:
|
39
|
+
def post_message(channel:, username:, attachments:, link_names:, icon_url:, fail_on_error:)
|
40
|
+
results = @notifier.ping('', channel: channel, username: username, link_names: link_names, icon_url: icon_url, attachments: attachments)
|
50
41
|
rescue => exception
|
51
42
|
UI.error("Exception: #{exception}")
|
52
43
|
ensure
|
@@ -56,13 +47,129 @@ module Fastlane
|
|
56
47
|
else
|
57
48
|
UI.verbose(result) unless result.nil?
|
58
49
|
message = "Error pushing Slack message, maybe the integration has no permission to post on this channel? Try removing the channel parameter in your Fastfile, this is usually caused by a misspelled or changed group/channel name or an expired SLACK_URL"
|
59
|
-
if
|
50
|
+
if fail_on_error
|
60
51
|
UI.user_error!(message)
|
61
52
|
else
|
62
53
|
UI.error(message)
|
63
54
|
end
|
64
55
|
end
|
65
56
|
end
|
57
|
+
|
58
|
+
# As there is a text limit in the notifications, we are
|
59
|
+
# usually interested in the last part of the message
|
60
|
+
# e.g. for tests
|
61
|
+
def self.trim_message(message)
|
62
|
+
# We want the last 7000 characters, instead of the first 7000, as the error is at the bottom
|
63
|
+
start_index = [message.length - 7000, 0].max
|
64
|
+
message = message[start_index..-1]
|
65
|
+
# We want line breaks to be shown on slack output so we replace
|
66
|
+
# input non-interpreted line break with interpreted line break
|
67
|
+
message.gsub('\n', "\n")
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.generate_slack_attachments(options)
|
71
|
+
color = (options[:success] ? 'good' : 'danger')
|
72
|
+
should_add_payload = ->(payload_name) { options[:default_payloads].map(&:to_sym).include?(payload_name.to_sym) }
|
73
|
+
|
74
|
+
slack_attachment = {
|
75
|
+
fallback: options[:message],
|
76
|
+
text: options[:message],
|
77
|
+
pretext: options[:pretext],
|
78
|
+
color: color,
|
79
|
+
mrkdwn_in: ["pretext", "text", "fields", "message"],
|
80
|
+
fields: []
|
81
|
+
}
|
82
|
+
|
83
|
+
# custom user payloads
|
84
|
+
slack_attachment[:fields] += options[:payload].map do |k, v|
|
85
|
+
{
|
86
|
+
title: k.to_s,
|
87
|
+
value: Slack::Notifier::Util::LinkFormatter.format(v.to_s),
|
88
|
+
short: false
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Add the lane to the Slack message
|
93
|
+
# This might be nil, if slack is called as "one-off" action
|
94
|
+
if should_add_payload[:lane] && Actions.lane_context[Actions::SharedValues::LANE_NAME]
|
95
|
+
slack_attachment[:fields] << {
|
96
|
+
title: 'Lane',
|
97
|
+
value: Actions.lane_context[Actions::SharedValues::LANE_NAME],
|
98
|
+
short: true
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# test_result
|
103
|
+
if should_add_payload[:test_result]
|
104
|
+
slack_attachment[:fields] << {
|
105
|
+
title: 'Result',
|
106
|
+
value: (options[:success] ? 'Success' : 'Error'),
|
107
|
+
short: true
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
# git branch
|
112
|
+
if Actions.git_branch && should_add_payload[:git_branch]
|
113
|
+
slack_attachment[:fields] << {
|
114
|
+
title: 'Git Branch',
|
115
|
+
value: Actions.git_branch,
|
116
|
+
short: true
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
# git_author
|
121
|
+
if Actions.git_author_email && should_add_payload[:git_author]
|
122
|
+
if FastlaneCore::Env.truthy?('FASTLANE_SLACK_HIDE_AUTHOR_ON_SUCCESS') && options[:success]
|
123
|
+
# We only show the git author if the build failed
|
124
|
+
else
|
125
|
+
slack_attachment[:fields] << {
|
126
|
+
title: 'Git Author',
|
127
|
+
value: Actions.git_author_email,
|
128
|
+
short: true
|
129
|
+
}
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# last_git_commit
|
134
|
+
if Actions.last_git_commit_message && should_add_payload[:last_git_commit]
|
135
|
+
slack_attachment[:fields] << {
|
136
|
+
title: 'Git Commit',
|
137
|
+
value: Actions.last_git_commit_message,
|
138
|
+
short: false
|
139
|
+
}
|
140
|
+
end
|
141
|
+
|
142
|
+
# last_git_commit_hash
|
143
|
+
if Actions.last_git_commit_hash(true) && should_add_payload[:last_git_commit_hash]
|
144
|
+
slack_attachment[:fields] << {
|
145
|
+
title: 'Git Commit Hash',
|
146
|
+
value: Actions.last_git_commit_hash(short: true),
|
147
|
+
short: false
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
151
|
+
# merge additional properties
|
152
|
+
deep_merge(slack_attachment, options[:attachment_properties])
|
153
|
+
end
|
154
|
+
|
155
|
+
# Adapted from https://stackoverflow.com/a/30225093/158525
|
156
|
+
def self.deep_merge(a, b)
|
157
|
+
merger = proc do |key, v1, v2|
|
158
|
+
Hash === v1 && Hash === v2 ?
|
159
|
+
v1.merge(v2, &merger) : Array === v1 && Array === v2 ?
|
160
|
+
v1 | v2 : [:undefined, nil, :nil].include?(v2) ? v1 : v2
|
161
|
+
end
|
162
|
+
a.merge(b, &merger)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.is_supported?(platform)
|
167
|
+
true
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.run(options)
|
171
|
+
require 'slack-notifier'
|
172
|
+
Runner.new(options[:slack_url]).run(options)
|
66
173
|
end
|
67
174
|
|
68
175
|
def self.description
|
@@ -185,99 +292,13 @@ module Fastlane
|
|
185
292
|
# @!group Helper
|
186
293
|
#####################################################
|
187
294
|
|
188
|
-
def self.
|
189
|
-
|
190
|
-
should_add_payload = ->(payload_name) { options[:default_payloads].map(&:to_sym).include?(payload_name.to_sym) }
|
191
|
-
|
192
|
-
slack_attachment = {
|
193
|
-
fallback: options[:message],
|
194
|
-
text: options[:message],
|
195
|
-
pretext: options[:pretext],
|
196
|
-
color: color,
|
197
|
-
mrkdwn_in: ["pretext", "text", "fields", "message"],
|
198
|
-
fields: []
|
199
|
-
}
|
200
|
-
|
201
|
-
# custom user payloads
|
202
|
-
slack_attachment[:fields] += options[:payload].map do |k, v|
|
203
|
-
{
|
204
|
-
title: k.to_s,
|
205
|
-
value: Slack::Notifier::Util::LinkFormatter.format(v.to_s),
|
206
|
-
short: false
|
207
|
-
}
|
208
|
-
end
|
209
|
-
|
210
|
-
# Add the lane to the Slack message
|
211
|
-
# This might be nil, if slack is called as "one-off" action
|
212
|
-
if should_add_payload[:lane] && Actions.lane_context[Actions::SharedValues::LANE_NAME]
|
213
|
-
slack_attachment[:fields] << {
|
214
|
-
title: 'Lane',
|
215
|
-
value: Actions.lane_context[Actions::SharedValues::LANE_NAME],
|
216
|
-
short: true
|
217
|
-
}
|
218
|
-
end
|
219
|
-
|
220
|
-
# test_result
|
221
|
-
if should_add_payload[:test_result]
|
222
|
-
slack_attachment[:fields] << {
|
223
|
-
title: 'Result',
|
224
|
-
value: (options[:success] ? 'Success' : 'Error'),
|
225
|
-
short: true
|
226
|
-
}
|
227
|
-
end
|
228
|
-
|
229
|
-
# git branch
|
230
|
-
if Actions.git_branch && should_add_payload[:git_branch]
|
231
|
-
slack_attachment[:fields] << {
|
232
|
-
title: 'Git Branch',
|
233
|
-
value: Actions.git_branch,
|
234
|
-
short: true
|
235
|
-
}
|
236
|
-
end
|
237
|
-
|
238
|
-
# git_author
|
239
|
-
if Actions.git_author_email && should_add_payload[:git_author]
|
240
|
-
if FastlaneCore::Env.truthy?('FASTLANE_SLACK_HIDE_AUTHOR_ON_SUCCESS') && options[:success]
|
241
|
-
# We only show the git author if the build failed
|
242
|
-
else
|
243
|
-
slack_attachment[:fields] << {
|
244
|
-
title: 'Git Author',
|
245
|
-
value: Actions.git_author_email,
|
246
|
-
short: true
|
247
|
-
}
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
# last_git_commit
|
252
|
-
if Actions.last_git_commit_message && should_add_payload[:last_git_commit]
|
253
|
-
slack_attachment[:fields] << {
|
254
|
-
title: 'Git Commit',
|
255
|
-
value: Actions.last_git_commit_message,
|
256
|
-
short: false
|
257
|
-
}
|
258
|
-
end
|
259
|
-
|
260
|
-
# last_git_commit_hash
|
261
|
-
if Actions.last_git_commit_hash(true) && should_add_payload[:last_git_commit_hash]
|
262
|
-
slack_attachment[:fields] << {
|
263
|
-
title: 'Git Commit Hash',
|
264
|
-
value: Actions.last_git_commit_hash(short: true),
|
265
|
-
short: false
|
266
|
-
}
|
267
|
-
end
|
268
|
-
|
269
|
-
# merge additional properties
|
270
|
-
deep_merge(slack_attachment, options[:attachment_properties])
|
295
|
+
def self.trim_message(message)
|
296
|
+
Runner.trim_message(message)
|
271
297
|
end
|
272
298
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
Hash === v1 && Hash === v2 ?
|
277
|
-
v1.merge(v2, &merger) : Array === v1 && Array === v2 ?
|
278
|
-
v1 | v2 : [:undefined, nil, :nil].include?(v2) ? v1 : v2
|
279
|
-
end
|
280
|
-
a.merge(b, &merger)
|
299
|
+
def self.generate_slack_attachments(options)
|
300
|
+
UI.deprecated('`Fastlane::Actions::Slack.generate_slack_attachments` is subject to be removed as Slack recommends migrating `attachments` to Block Kit. fastlane will also follow the same direction.')
|
301
|
+
Runner.generate_slack_attachments(options)
|
281
302
|
end
|
282
303
|
end
|
283
304
|
end
|