Created
August 18, 2024 12:32
-
-
Save riosengineer/2a29576cc7162dd00c00166c9d09f9a7 to your computer and use it in GitHub Desktop.
Bicep Module Git Diff
This file contains hidden or 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
$version = get-date -Format yyyy-MM-dd | |
$commit = "$ENV:BUILD_SOURCEVERSION" | |
# get the latest Bicep module files changed | |
$files = $(git diff HEAD HEAD~ --name-only -- bicep/modules ":(exclude)*/.tests/*" | Where-Object {$_.EndsWith('.bicep')}) | |
if ($files.count -ge 1) { | |
# copy files to staging | |
copy-item $files -Destination $ENV:BUILD_ARTIFACTSTAGINGDIRECTORY | |
# set a variable and build number | |
Write-Host ("##vso[task.setvariable variable=bicepFiles]true") | |
Write-host ("##vso[build.updatebuildnumber]$($version)") | |
Write-Host $files updates found | |
} | |
else { | |
Write-Host ("##vso[task.setvariable variable=bicepFiles]false") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment