Created
June 10, 2021 14:08
-
-
Save StefanMaron/29d58eee05fdf32893066bb5494bde3f to your computer and use it in GitHub Desktop.
CheckCommitContraints.ps1
This file contains 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
$AppJsonFiles = git diff --staged --name-only | |
$AppJsonFiles | ForEach-Object { | |
if ($_ -like "*app.json") { | |
$appJson = git show :$_ | |
$appJson = $appJson | ConvertFrom-Json | |
$appJsonVersion = [System.Version]$appJson.Version | |
if ($appJsonVersion.Build -ne 0) { | |
Throw ("The build number in the file '{0}' must be 0" -f $_) | |
} | |
if ($appJsonVersion.Revision -ne 0) { | |
Throw ("The revision number in the file '{0}' must be 0" -f $_) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment