@@ -8,7 +8,7 @@ module Actions
88 class FindPreviousTagAction < Action
99 def self . run ( params )
1010 tag_pattern = params [ :pattern ]
11- exclude_pattern = params [ :exclude ]
11+ exclude_patterns = Array ( params [ :exclude ] )
1212
1313 # Make sure we have all the latest tags fetched locally
1414 Actions . sh ( 'git' , 'fetch' , '--tags' , '--force' ) { nil }
@@ -18,7 +18,7 @@ def self.run(params)
1818 # Finally find the previous tag matching the provided pattern, and that is not the current commit
1919 git_cmd = %w[ git describe --tags --abbrev=0 ]
2020 git_cmd += [ '--match' , tag_pattern ] unless tag_pattern . nil?
21- git_cmd += [ '--exclude' , exclude_pattern ] unless exclude_pattern . nil?
21+ exclude_patterns . each { | p | git_cmd += [ '--exclude' , p ] }
2222 git_cmd += [ '--exclude' , current_commit_tag ] unless current_commit_tag . empty?
2323 Actions . sh ( *git_cmd ) { |exit_status , stdout , _ | exit_status . success? ? stdout . chomp : nil }
2424 end
@@ -41,7 +41,8 @@ def self.details
4141 reachable from the current commit and that matches a specific naming pattern
4242
4343 e.g. `find_previous_tag(pattern: '12.3.*.*')`, `find_previous_tag(pattern: '12.3-rc-*')`,
44- `find_previous_tag(pattern: 'v*', exclude: '*beta*')`
44+ `find_previous_tag(pattern: 'v*', exclude: '*beta*')`,
45+ `find_previous_tag(pattern: 'v*', exclude: ['*alpha*', '*beta*'])`
4546 DETAILS
4647 end
4748
@@ -53,10 +54,11 @@ def self.available_options
5354 default_value : nil ,
5455 type : String ) ,
5556 FastlaneCore ::ConfigItem . new ( key : :exclude ,
56- description : 'An _fnmatch_-style pattern of tags to exclude from the search (maps to `git describe --exclude`)' ,
57+ description : 'One or more _fnmatch_-style patterns of tags to exclude from the search (maps to `git describe --exclude`). ' \
58+ 'Can be a single string or an array of strings' ,
5759 optional : true ,
5860 default_value : nil ,
59- type : String ) ,
61+ is_string : false ) ,
6062 ]
6163 end
6264
0 commit comments