Updates regex syntax tests

To see the new regex syntax in action go to
https://regex101.com/r/t1JcmL/13.
This commit is contained in:
rickstaa
2020-12-12 16:27:38 +01:00
parent 6a229db7d8
commit d15af245f4
2 changed files with 27 additions and 16 deletions

View File

@@ -10,6 +10,7 @@ REPO="${INPUT_REPO:-reviewdog/reviewdog}"
VERSION_NAME="${INPUT_VERSION_NAME:-REVIEWDOG_VERSION}"
# Get current version.
# NOTE: Go to https://regex101.com/r/t1JcmL/13 To see the current regex in action.
CURRENT_VERSION=$(grep -oP "${VERSION_NAME}(?:\s*=\s*|:?\s*)[\"|\']?v?\K\d+\.\d+(\.\d+)?(-[^\'\"\s]*)?" "${FILE}" | head -n1)
if [ -z "${CURRENT_VERSION}" ]; then
echo "cannot parse ${VERSION_NAME}"