forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerateMetadata.ps1
34 lines (32 loc) · 1.03 KB
/
generateMetadata.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Write-Host $([DateTime]::UtcNow.ToString('u').Replace('Z',' UTC'))
Write-Host ""
Write-Host "1) azure-rest-api-specs repository information"
Write-Host "GitHub user:" $Args[0]
Write-Host "Branch: " $Args[1]
Try
{
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Write-Host "Commit: " (Invoke-RestMethod "https://api.github.com/repos/$($Args[0])/azure-rest-api-specs/branches/$($Args[1])").commit.sha
}
Catch
{
# if the above REST call fails, a commit ID was passed, so we already got the information we need
}
Write-Host ""
Write-Host "2) AutoRest information"
Write-Host "Requested version:" $Args[2]
Try
{
Write-Host "Bootstrapper version: " (npm list -g autorest)
}
Catch{}
Try
{
Write-Host "Latest installed version: " (autorest --list-installed | Where {$_ -like "*Latest Core Installed*"}).Split()[-1]
}
Catch{}
Try
{
Write-Host "Latest installed version: " (autorest --list-installed | Where {$_ -like "*@microsoft.azure/autorest-core*"} | Select -Last 1).Split('|')[3]
}
Catch{}