@@ -127,12 +127,7 @@ public override Task<bool> Sure()
127
127
ProgressDescription = "Run custom action ..." ;
128
128
129
129
var cmdline = CustomAction . Arguments . Replace ( "${REPO}" , GetWorkdir ( ) ) ;
130
- if ( Target is Models . Branch b )
131
- cmdline = cmdline . Replace ( "${BRANCH}" , b . FriendlyName ) ;
132
- else if ( Target is Models . Commit c )
133
- cmdline = cmdline . Replace ( "${SHA}" , c . SHA ) ;
134
- else if ( Target is Models . Tag t )
135
- cmdline = cmdline . Replace ( "${TAG}" , t . Name ) ;
130
+ cmdline = PrepareStringByTarget ( cmdline ) ;
136
131
137
132
for ( var i = ControlParameters . Count - 1 ; i >= 0 ; i -- )
138
133
{
@@ -165,18 +160,30 @@ private void PrepareControlParameters()
165
160
switch ( ctl . Type )
166
161
{
167
162
case Models . CustomActionControlType . TextBox :
168
- ControlParameters . Add ( new CustomActionControlTextBox ( ctl . Label , ctl . Description , ctl . StringValue ) ) ;
163
+ ControlParameters . Add ( new CustomActionControlTextBox ( ctl . Label , ctl . Description , PrepareStringByTarget ( ctl . StringValue ) ) ) ;
169
164
break ;
170
165
case Models . CustomActionControlType . CheckBox :
171
166
ControlParameters . Add ( new CustomActionControlCheckBox ( ctl . Label , ctl . Description , ctl . StringValue , ctl . BoolValue ) ) ;
172
167
break ;
173
168
case Models . CustomActionControlType . PathSelector :
174
- ControlParameters . Add ( new CustomActionControlPathSelector ( ctl . Label , ctl . Description , ctl . BoolValue , ctl . StringValue ) ) ;
169
+ ControlParameters . Add ( new CustomActionControlPathSelector ( ctl . Label , ctl . Description , ctl . BoolValue , PrepareStringByTarget ( ctl . StringValue ) ) ) ;
175
170
break ;
176
171
}
177
172
}
178
173
}
179
174
175
+ private string PrepareStringByTarget ( string org )
176
+ {
177
+ if ( Target is Models . Branch b )
178
+ return org . Replace ( "${BRANCH}" , b . FriendlyName ) ;
179
+ else if ( Target is Models . Commit c )
180
+ return org . Replace ( "${SHA}" , c . SHA ) ;
181
+ else if ( Target is Models . Tag t )
182
+ return org . Replace ( "${TAG}" , t . Name ) ;
183
+
184
+ return org ;
185
+ }
186
+
180
187
private string GetWorkdir ( )
181
188
{
182
189
return OperatingSystem . IsWindows ( ) ? _repo . FullPath . Replace ( "/" , "\\ " ) : _repo . FullPath ;
0 commit comments