Add exclude parameter to find_previous_tag action#696
Conversation
0d5c716 to
4208ed7
Compare
Great idea! Added on 4208ed7. |
| 'Can be a single string or an array of strings', | ||
| optional: true, | ||
| default_value: nil, | ||
| is_string: false), |
There was a problem hiding this comment.
The use of is_string: is deprecated in ConfigItem, and has been replaced by type: instead.
| is_string: false), | |
| type: Array), |
There was a problem hiding this comment.
Ah indeed, though the type could be a string as well (single string or Array)... will that work with type? 🤔 Or better to restrict it to be always an array?
There was a problem hiding this comment.
I believe if the ConfigItem's type is Array but you pass a String it gets auto-converted into an array and validation should thus pass in those cases too.
Though wouldn't hurt to add a small spec example if you want to ensure this case is covered as expected anyway.
There was a problem hiding this comment.
Updated on d09c29d, enforcing it to be always array (thinking about it, it's fine as it's a new parameter anyway).
There was a problem hiding this comment.
...and the auto-conversion works! 4121687 (chef's kiss)
| it 'auto-converts a single exclude string into an array' do | ||
| # Arrange | ||
| stub_current_commit_tag(nil) | ||
| stub_main_command( | ||
| %w[git describe --tags --abbrev=0 --match v* --exclude *beta*], | ||
| stdout: 'v1.7.3' | ||
| ) | ||
| # Act — Fastlane's ConfigItem auto-converts a String to Array when type is Array | ||
| tag = run_described_fastlane_action( | ||
| pattern: 'v*', | ||
| exclude: '*beta*' | ||
| ) | ||
| # Assert | ||
| expect(tag).to eq('v1.7.3') | ||
| end |
There was a problem hiding this comment.
Nice to have that confirmed by a unit test 👍
Fixes AINFRA-2056
What does it do?
Adds an optional
excludeparameter to thefind_previous_tagaction that maps to git's--excludeflag, allowing callers to skip beta/pre-release tags when searching for the previous stable release tag — e.g.find_previous_tag(pattern: 'v*', exclude: '*beta*').Checklist before requesting a review
bundle exec rubocopto test for code style violations and recommendations.specs/*_spec.rb) if applicable.bundle exec rspecto run the whole test suite and ensure all your tests pass.CHANGELOG.mdfile to describe your changes under the appropriate existing###subsection of the existing## Trunksection.MIGRATION.mdfile to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider.