Skip to content

Commit 6ce6476

Browse files
Validate Version format as Major.Minor.Patch before build
1 parent 32d3e81 commit 6ce6476

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ if ([string]::IsNullOrWhiteSpace($moduleVersion)) {
3838
throw 'Version is required. Please provide a module version.'
3939
}
4040

41+
if ($moduleVersion -notmatch '^\d+\.\d+\.\d+$') {
42+
throw "Version '$moduleVersion' is not a valid version. Expected format: 'Major.Minor.Patch' (e.g., '1.2.3')."
43+
}
44+
4145
Set-GitHubLogGroup 'Build local scripts' {
4246
Write-Host 'Execution order:'
4347
$scripts = Get-ChildItem -Filter '*build.ps1' -Recurse | Sort-Object -Property Name | Resolve-Path -Relative

0 commit comments

Comments
 (0)