mirror of
https://dev.azure.com/effectory/Survey%20Software/_git/Cloud%20Engineering
synced 2026-02-27 18:52:18 +01:00
Script to list Azure devops repos
This commit is contained in:
48
Powershell/Lists/Repositories.ps1
Normal file
48
Powershell/Lists/Repositories.ps1
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
class Repository {
|
||||
[string] $Id = ""
|
||||
[string] $Name = ""
|
||||
[string] $DefaultBranch = ""
|
||||
[string] $IsDisabled = ""
|
||||
[string] $WebUrl = ""
|
||||
[string] $LastPRDate = ""
|
||||
[string] $LastPRName = ""
|
||||
[string] $LastPRUrl = ""
|
||||
}
|
||||
|
||||
$fileName = "c:\temp\2023-05-03 repositories.csv"
|
||||
|
||||
Write-Host "========================================================================================================================================================================"
|
||||
Write-Host "Creating repository overview."
|
||||
Write-Host "========================================================================================================================================================================"
|
||||
|
||||
$repos = az repos list --organization "https://dev.azure.com/effectory/" --project "survey software" | ConvertFrom-Json | Select-Object
|
||||
|
||||
[Repository[]]$Result = @()
|
||||
|
||||
foreach ($repo in $repos)
|
||||
{
|
||||
[Repository] $repository = [Repository]::new()
|
||||
$repository.Id = $repo.id
|
||||
$repository.Name = $repo.name
|
||||
$repository.DefaultBranch = $repo.defaultBranch
|
||||
$repository.IsDisabled = $repo.isDisabled
|
||||
$repository.WebUrl = $repo.webUrl
|
||||
|
||||
$lastPr = az repos pr list --project "survey software" --repository $repo.name --organization "https://dev.azure.com/effectory/" --status all --top 1 | ConvertFrom-Json | Select-Object
|
||||
|
||||
if ($lastPr) {
|
||||
$repository.LastPRDate = $lastPr.creationDate
|
||||
$repository.LastPRName = $lastPr.title
|
||||
$repository.LastPRUrl = $lastPr.url
|
||||
}
|
||||
|
||||
$Result += $repository
|
||||
}
|
||||
|
||||
$Result | Export-Csv -Path $fileName -Append -NoTypeInformation
|
||||
|
||||
Write-Host "========================================================================================================================================================================"
|
||||
Write-Host "Done."
|
||||
|
||||
# az repos pr list --project "survey software" --repository "ProjectCenter" --organization "https://dev.azure.com/effectory/" --status all --top 1
|
||||
Reference in New Issue
Block a user