Update write-changelog.ps1

This commit is contained in:
Markus Fleschutz 2023-10-19 08:03:42 +02:00
parent bb6b9b4aa5
commit b892eb7b17

View File

@ -1,9 +1,11 @@
<# <#
.SYNOPSIS .SYNOPSIS
Writes a changelog Writes a changelog from Git commits
.DESCRIPTION .DESCRIPTION
This PowerShell script writes an automated changelog to the console in Markdown format by using the Git commits. This PowerShell script writes an automated changelog in Markdown format to the console by using the Git commits only.
NOTE: You may also redirect the output into a file for later use. NOTE: For proper sorting the Git commits should start with verbs such as 'Add', 'Fix', 'Update', etc. You may also redirect the output into a file for later use.
.PARAMETER RepoDir
Specifies the path to the local Git repository (default is current working dir)
.EXAMPLE .EXAMPLE
PS> ./write-changelog.ps1 PS> ./write-changelog.ps1
@ -37,37 +39,24 @@ try {
$commits = (git -C "$RepoDir" log --boundary --pretty=oneline --pretty=format:%s | sort -u) $commits = (git -C "$RepoDir" log --boundary --pretty=oneline --pretty=format:%s | sort -u)
Write-Progress "⏳ (5/6) Sorting the Git commit messages..." Write-Progress "⏳ (5/6) Sorting the Git commit messages..."
$features = @() $new = @()
$fixes = @() $fixes = @()
$updates = @() $updates = @()
$various = @() $various = @()
foreach($commit in $commits) { foreach($commit in $commits) {
if ($commit -like "New*") { if ($commit -like "New*") { $new += $commit
$features += $commit } elseif ($commit -like "Add*") { $new += $commit
} elseif ($commit -like "Add*") { } elseif ($commit -like "Create*") { $new += $commit
$features += $commit } elseif ($commit -like "Fix*") { $fixes += $commit
} elseif ($commit -like "Create*") { } elseif ($commit -like "Hotfix*") { $fixes += $commit
$features += $commit } elseif ($commit -like "Bugfix*") { $fixes += $commit
} elseif ($commit -like "Fix*") { } elseif ($commit -like "Update*") { $updates += $commit
$fixes += $commit } elseif ($commit -like "Updating*") { $updates += $commit
} elseif ($commit -like "Hotfix*") { } elseif ($commit -like "Updaate*") { $updates += $commit
$fixes += $commit } elseif ($commit -like "Adapt*") { $updates += $commit
} elseif ($commit -like "Bugfix*") { } elseif ($commit -like "Improve*") { $updates += $commit
$fixes += $commit } elseif ($commit -like "Change*") { $updates += $commit
} elseif ($commit -like "Update*") { } elseif ($commit -like "Changing*") { $updates += $commit
$updates += $commit
} elseif ($commit -like "Updating*") {
$updates += $commit
} elseif ($commit -like "Updaate*") {
$updates += $commit
} elseif ($commit -like "Adapt*") {
$updates += $commit
} elseif ($commit -like "Improve*") {
$updates += $commit
} elseif ($commit -like "Change*") {
$updates += $commit
} elseif ($commit -like "Changing*") {
$updates += $commit
} else { } else {
$various += $commit $various += $commit
} }
@ -83,7 +72,7 @@ try {
Write-Output " " Write-Output " "
Write-Output "🚀 New Features" Write-Output "🚀 New Features"
Write-Output "---------------" Write-Output "---------------"
foreach($c in $features) { foreach($c in $new) {
Write-Output "* $c" Write-Output "* $c"
} }
Write-Output " " Write-Output " "