-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitjc.ps1
36 lines (28 loc) · 834 Bytes
/
gitjc.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
35
36
<#
.SYNOPSIS
Shows jira sprint and branches off develop
#>
[CmdletBinding()]
param (
[Parameter()]
[string] $BranchName
)
$script:ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
$defBranch = Get-GitDefaultBranch
git checkout $defBranch
git pull --recurse-submodules=false
if (-not $BranchName) {
jspr
$BranchName = Read-Host -Prompt "branch name"
}
git checkout -b $BranchName
if ($BranchName -match '^\w+-\d+[_-]') {
$issue = $matches[0].TrimEnd('_','-')
$o = jira view $issue -t json | ConvertFrom-Json
if ($o.fields.status.name -match 'New|Prioritized Backlog|Ready for Grooming|Sprint Ready' -and (!$o.fields.assignee -or $o.fields.assignee.name -eq 'walshca')) {
jira transition 'In Progress' $issue --noedit
jira assign $issue walshca
}
}
code (git rev-parse --show-toplevel)