Skip to content

Instantly share code, notes, and snippets.

@jincod
Last active August 10, 2017 11:25
Show Gist options
  • Save jincod/1bb4681bf34ed1bff5c2d127b7e4b413 to your computer and use it in GitHub Desktop.
Save jincod/1bb4681bf34ed1bff5c2d127b7e4b413 to your computer and use it in GitHub Desktop.
Function GetChangelog {
param($from, $to, $baseurl, $project)
$cred = (Get-Credential)
$username = $cred.GetNetworkCredential().username
$password = $cred.GetNetworkCredential().password
$auth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$($username):$($password)"))
git log --oneline --grep="$project-" "$from..$to" |
select-string "$project-(\d+)" -AllMatches |
Foreach-Object {$_.Matches} |
Foreach-Object {$_.Groups[1].Value} |
select -uniq |
sort { [int]$_} |
% { iwr "$($baseurl)/rest/api/2/issue/$($project)-$_" -Headers @{"Authorization" = "Basic $auth"} } |
ConvertFrom-Json |
% { "$($_.key) ($($baseurl)/browse/$($_.key)) $($_.fields.summary)"}
}
@jincod
Copy link
Author

jincod commented Aug 10, 2017

. { iwr -useb https://gist.github.com/jincod/1bb4681bf34ed1bff5c2d127b7e4b413/raw/changelog.ps1 }| iex; GetChangelog -from origin/master -to origin/develop -baseurl https://jira.local -project JIRA_PROJECT_KEY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment