JiraPS
JiraPS copied to clipboard
Feature: Converting to and from different IssueTypes (like sub-tasks)
Context
Iv'e been looking for commands that can change an Issue to/from subtasks (and other types as well) as this is possible using the GUI.
New-JiraIssue -Parent <key> -IssueType 'Sub-Task'
(do exist)
Set-JiraIssue -Key <key> -IssueType 'Sub-task' -Parent <key>
(doesn't exist)
Maybe this would be possible using the -Fields argument? But that's a rabbits hole.
Description
A new command seems necessary for these actions.
Convert-JiraIssueType
ArgSet 1
- -Key string mandatory
- -IssueType string mandatory ('Sub-task' not allowed)
- -Force
ArgSet 2
- -Key string mandatory
- -Parent string mandatory (implies the issue type will be 'Sub-task')
- -Force
# Create a main task in a project labeled 'MYPROJ' using 'jane' as reporter
New-JiraIssue -Project 'MYPROJ' -Summary 'Main example' -IssueType 'Task' -Reporter 'jane'
Key Summary
--- -------
MYPROJ-1 Main example
# Creta a subtask to MYPROJ-1
New-JiraIssue -Project 'MYPROJ' -Summary 'Sub example' -IssueType 'Sub-task' -Parent 'MYRPOJ-1' -Reporter 'jane'
Key Summary
--- -------
MYPROJ-2 Sub example
# Create a task and then convert it to a subtask of MYPROJ-1
New-JiraIssue -Project 'MYPROJ' -Summary 'Second example' -IssueType 'Task' -Reporter 'jane'
Key Summary
--- -------
MYPROJ-3 Second example
Convert-JiraIssueType -Key 'MYPROJ-3' -Parent 'MYPROJ' -Force
Key Summary
--- -------
MYPROJ-3 Second example
# Convert a subtask to a task
Convert-JiraIssueType -Key 'MYPROJ-2' -IssueType 'Task' -Force
Key Summary
--- -------
MYPROJ-2 Second example
Additional Information
Also, piping a stored JIRA object, that's been changed, to Set-JiraIssue should set all properties changed (if in an allowed combination).
New-JiraIssue -Project 'MYPROJ' -Summary 'Third example' -IssueType 'Task' -Reporter 'jane'
Key Summary
--- -------
MYPROJ-4 Second example
$task = Get-JiraIssue -Key 'MYPROJ-4'
$task.parent.key = 'MYPROJ-1'
$task.issuetype.subtask = $false
$task | Set-JiraIssue -Force
Key Summary
--- -------
MYPROJ-4 Second example