Skip to content

Instantly share code, notes, and snippets.

@Clijsters
Last active September 10, 2018 12:54
Show Gist options
  • Save Clijsters/d0b99649d2d2010523190b256ac969d8 to your computer and use it in GitHub Desktop.
Save Clijsters/d0b99649d2d2010523190b256ac969d8 to your computer and use it in GitHub Desktop.
Get a dependency Graph from blocking Jira Issues for all issues in epic
#=== Step 1: Download and Install (or just extract) GraphViz
#=== Step 2: Execute the following statements if you run this for the 1st time:
# Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
# Install-Module PSGraph -Scope CurrentUser -Force
# Install-Module JiraPS -Scope CurrentUser -Force
# Set-JiraConfigServer "https://jira.contoso.com"
#=== Step 3: Set the following variable to your GraphViz binary path:
$graphVizPath = "C:\path\to\your\folder\dot.exe"
#=== Step 4: Run this script by typing its path in PowerShell.
$enriched = @()
$epicKey = Read-Host -Prompt "Please type in your Epic key (PROJ-1234)"
if (-not (Get-JiraSession)) {New-JiraSession}
Get-JiraIssue -JQL "`"Epic Link`" = $epicKey" | ForEach-Object {
$key = $_.Key;
$links = $_.IssueLinks
$linksList = New-Object System.Collections.ArrayList
foreach ($link in $links) {
$linksList.Add((New-Object psobject -Property @{name = $link.Type.OutwardText; key = $link.OutwardIssue.Key})) | Out-Null
}
$enriched += New-Object psobject -property @{issue = $key; links = $linksList}
}
graph g {
node -default @{shape = 'rectangle'}
foreach ($node in $enriched | Where-Object {$_.links}) {
foreach ($link in $node.links) {
if ($link.name -eq "Blocks") {
edge $node.issue -to $link.key @{label = $link.name}
}
}
}
} | Export-PSGraph -ShowGraph -GraphVizPath $graphVizPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment