Skip to content

Instantly share code, notes, and snippets.

@riosengineer
Created August 18, 2024 12:32
Show Gist options
  • Save riosengineer/2a29576cc7162dd00c00166c9d09f9a7 to your computer and use it in GitHub Desktop.
Save riosengineer/2a29576cc7162dd00c00166c9d09f9a7 to your computer and use it in GitHub Desktop.
Bicep Module Git Diff
$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