DevOps.psm1
<#
.SYNOPSIS Creates a feature or issue branch based on a Backlogitem ID, publises it and creates a draft PR. .PARAMETER bliId Id of Backlogitem #> function New-DevEnv { [CmdletBinding()] Param( [Parameter(Mandatory=$true)] [int] $bliId ) #end param Write-Output "Fetching Data for Backlogitem ${bliId}..."; $item = (az boards work-item show --id $bliId) | ConvertFrom-Json; $title = $item.fields."System.Title"; $workItemType = $item.fields."System.WorkItemType"; $title = $title.ToLower().replace(' ', '_'); if($workItemType -eq "Bug") { Write-Output "Creating git flow Bugfixbranch..."; . git flow bugfix start "${bliId}_${title}" | Out-Null; Write-Output "Publishing branch..." . git flow bugfix publish | Out-Null; } else { Write-Output "Creating git flow Featurebranch..."; . git flow feature start "${bliId}_${title}" | Out-Null; Write-Output "Publishing branch..." . git flow feature publish | Out-Null; } Write-Output "Creating Draft Pullrequest..." Get-Location . az.cmd repos pr create --open --work-items $bliId --draft | Out-Null; } |