Skip to content

Commit 12c260f

Browse files
authored
Merge pull request #114 from salesforcecli/ew/validate-semver
Reject invalid semver
2 parents 444fcf4 + 66952ac commit 12c260f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/actions/parse-semver/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ runs:
3434
FULL_VERSION="${{ inputs.input_string }}"
3535
VERSION="${FULL_VERSION#v}"
3636
37+
# Filter out non-semver characters
38+
CLEAN_VERSION=$(echo "$VERSION" | sed -E 's/[^0-9a-zA-Z.-]+//g')
39+
40+
if [[ "$CLEAN_VERSION" != "$VERSION" ]]; then
41+
echo "Semver version includes invalid characters. Exiting..."
42+
exit 1
43+
fi
44+
3745
# Split version into parts
3846
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
3947

0 commit comments

Comments
 (0)