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(' ', '_'); $action = "feature"; if($workItemType -eq "Bug") { $action = "bugfix" } Write-Output "Creating git flow ${action} branch..."; . git flow $action start "${bliId}_${title}" | Out-Null; Write-Output "Publishing branch..." . git flow $action publish | Out-Null; Write-Output "Creating Draft Pullrequest..." $pr = (. az.cmd repos pr create --open --work-items $bliId --draft); } |