@@ -49,20 +49,28 @@ if ($branch -ne $env:targetBranch) {
4949 git pull origin $env: targetBranch -- ff- only | Write-Host
5050}
5151
52- # Download the metadata from livesite.
53- $url = " https://graph.microsoft.com/{0}/`$ metadata" -f $env: endpointVersion
54- $metadataFileName = " {0}_metadata.xml" -f $env: endpointVersion
55- $pathToLiveMetadata = Join-Path - Path ($pwd ).path - ChildPath $metadataFileName
56- $client = new-object System.Net.WebClient
57- $client.Encoding = [System.Text.Encoding ]::UTF8
58- Write-Host " Attempting to downloaded metadata from $url to $pathToLiveMetadata " - ForegroundColor DarkGreen
59- $client.DownloadFile ($url , $pathToLiveMetadata )
60- Write-Host " Downloaded metadata from $url to $pathToLiveMetadata " - ForegroundColor DarkGreen
52+ if ($env: inputMetadataFile.StartsWith (" http" , [StringComparison ]::OrdinalIgnoreCase)){
53+ # Download metadata from livesite.
54+ $url = " https://graph.microsoft.com/{0}/`$ metadata" -f $env: endpointVersion
55+ $metadataFileName = " {0}_metadata.xml" -f $env: endpointVersion
56+ $pathToLiveMetadata = Join-Path - Path ($pwd ).path - ChildPath $metadataFileName
57+ $client = new-object System.Net.WebClient
58+ $client.Encoding = [System.Text.Encoding ]::UTF8
59+ Write-Host " Attempting to download metadata from $url to $pathToLiveMetadata " - ForegroundColor DarkGreen
60+ $client.DownloadFile ($url , $pathToLiveMetadata )
61+ Write-Host " Downloaded metadata from $url to $pathToLiveMetadata " - ForegroundColor DarkGreen
6162
62- # Format the metadata to make it easy for us hoomans to read and perform non-markup line based diffs.
63- $content = Format-Xml (Get-Content $pathToLiveMetadata )
64- [IO.File ]::WriteAllLines($pathToLiveMetadata , $content )
65- Write-Host " Wrote $metadataFileName to disk. Now git will tell us whether there are changes." - ForegroundColor DarkGreen
63+ # Format the metadata to make it easy for us hoomans to read and perform non-markup line based diffs.
64+ $content = Format-Xml (Get-Content $pathToLiveMetadata )
65+ [IO.File ]::WriteAllLines($pathToLiveMetadata , $content )
66+ Write-Host " Wrote $metadataFileName to disk. Now git will tell us whether there are changes." - ForegroundColor DarkGreen
67+ }
68+ else {
69+ # Retrieve the metadata from ./schemas folder in the metadata repo.
70+ Write-Host " Retrieving metadata from $env: inputMetadataFile " - ForegroundColor DarkGreen
71+ $content = Format-Xml (Get-Content $env: inputMetadataFile )
72+ Write-Host " Retrieved metadata from $env: inputMetadataFile " - ForegroundColor DarkGreen
73+ }
6674
6775# Discover if there are changes between the downloaded file and what is in git.
6876[array ]$result = git status -- porcelain
0 commit comments