-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-ReleaseStatus.ps1
More file actions
48 lines (38 loc) · 1.61 KB
/
Get-ReleaseStatus.ps1
File metadata and controls
48 lines (38 loc) · 1.61 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#Requires -Version 7
#Requires -PSEdition Core
$cloneDirectoryName = 'temporaryCloneDirectory'
$remoteUrl = "https://netchexonline@dev.azure.com/netchexonline/Netchex%20Rewrite/_git/Netchex.GeneralLedger.Api"
$targetBranch = "main"
$sourceBranch = "release.candidate"
$clonePath = $PSScriptRoot | Join-Path -ChildPath $cloneDirectoryName
Write-Host "Cloning into Netchex.GeneralLedger.Api... `n"
git clone $remoteUrl $clonePath --quiet
Push-Location
Set-Location $clonePath
git checkout $sourceBranch --quiet
$diffs = git cherry main
| Where-Object { $_.StartsWith("+") }
| ForEach-Object {
$commitSha = $_.Substring(2)
$author = git show -s --format='%an' $commitSha
$date = git show -s --format='%ci' $commitSha
[pscustomobject]@{ commit = $commitSha; author = $author; date = $date } }
| Sort-Object -Property date -Descending
if ($diffs.Count -gt 0)
{
Write-Host "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀"
Write-Host "🚀 Eligible for release! 🚀"
Write-Host "🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀`n"
Write-Host "Found $($diffs.Count) commits in $sourceBranch that are not in $targetBranch"
Write-Host "Authors in order of most recent changes:`n"
Write-Host "$($diffs | Select-Object -ExpandProperty author -Unique | Join-String -Separator `n)"
Write-Host
}
else
{
Write-Host "❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌"
Write-Host "❌ No changes slated for release ❌"
Write-Host "❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌`n"
}
Pop-Location
Remove-Item $clonePath -Recurse -Force