Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CheckCommitContraints.ps1
$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