Repository navigation
Improve string split to handle whitespace - #343
Merged
Merged
Conversation
joshmgross
self-requested a review
June 2, 2020 16:03
dhadka
force-pushed
the
improve-string-split
branch
from
June 2, 2020 16:09
eacf9ca to
5aa5bf1
Compare
mzabaluev
reviewed
Jun 2, 2020
| return core | ||
| .getInput(name, options) | ||
| .split("\n") | ||
| .map(s => s.trim()) |
There was a problem hiding this comment.
I suppose this gets rid of the "\r" on Windows as well, which I believe was the issue observed in #330 (comment)
Contributor
Author
There was a problem hiding this comment.
Yes, I also added a test for this case.
dhadka
force-pushed
the
improve-string-split
branch
from
June 2, 2020 19:19
5aa5bf1 to
1c50d1d
Compare
mzabaluev
reviewed
Jun 2, 2020
mzabaluev
left a comment
There was a problem hiding this comment.
The changes look good.
To further improve robustness, I think, the following normalizations would be useful:
- Remove any whitespace between
!and the path; - Sort the resulting entries.
Update readme and examples to use v2
dhadka
force-pushed
the
improve-string-split
branch
from
June 2, 2020 22:07
1c50d1d to
d60d2be
Compare
Contributor
Author
|
@mzabaluev Those are both good suggestions. I've filed an enhancement here - #345. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, the following two cache definitions result in two separate caches:
Don't see any difference? There's an extra whitespace in one. This results in different version hashes, which ends up creating two different caches.
This PR calls
trim()on each entry in thepathandrestore-keysto remove any leading and trailing whitespace. Additionally, this moves the split logic to a separate method and adds unit test coverage.