Skip to content

Commit

Permalink
Merge pull request #168 from theohbrothers/feature/generate-add-addit…
Browse files Browse the repository at this point in the history
…ional-matches-for-commit-categories

Feature (generate): Add additional matches for commit categories
  • Loading branch information
joeltimothyoh authored Jul 26, 2024
2 parents 6910038 + 139935b commit 1e1ff01
Show file tree
Hide file tree
Showing 12 changed files with 516 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,72 @@ function Changes-HashSubject-NoMerges-Categorized {
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitHistoryCategory = @(
@{
Name = 'Breaking'
Title = 'Breaking'
Name = @(
'Breaking'
'breaking-change'
)
}
@{
Name = 'Feature'
Title = 'Features'
Name = @(
'Feature'
'feat'
)
}
@{
Name = 'Enhancement'
Title = 'Enhancements'
Name = @(
'Enhancement'
)
}
@{
Name = 'Change'
Title = 'Change'
Name = @(
'Change'
)
}
@{
Name = 'Refactor'
Title = 'Refactors'
Name = @(
'Refactor'
)
}
@{
Name = 'CI'
Title = 'CI'
Name = @(
'CI'
)
}
@{
Name = 'Test'
Title = 'Tests'
Name = @(
'Test'
)
}
@{
Name = 'Fix'
Title = 'Fixes'
Name = @(
'Fix'
)
}
@{
Name = 'Style'
Title = 'Style'
Name = @(
'Style'
)
}
@{
Name = 'Docs'
Title = 'Documentation'
Name = @(
'Docs'
)
}
@{
Name = 'Chore'
Title = 'Chore'
Name = @(
'Chore'
)
}
)
$commitHistoryCategoryNone = @{
Expand All @@ -75,7 +99,7 @@ function Changes-HashSubject-NoMerges-Categorized {
$commitHistoryCategorizedCollection = New-Object System.Collections.ArrayList
$commitHistoryUncategorizedCollection = New-Object System.Collections.ArrayList
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*\w+\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if ($_ -match "^[0-9a-f]+ (\s*[a-zA-Z0-9_\-]+\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
$commitHistoryCategorizedCollection.Add($_) > $null
}else {
$commitHistoryUncategorizedCollection.Add($_) > $null
Expand All @@ -88,18 +112,21 @@ function Changes-HashSubject-NoMerges-Categorized {
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if (!$iscommitHistoryCategoryTitleOutputted) {
foreach ($n in $c['Name']) {
if ($_ -match "^[0-9a-f]+ (\s*$n\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$iscommitHistoryCategoryTitleOutputted = $true
}
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
"@
break
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,72 @@ function Changes-HashSubject-NoMerges-CategorizedSorted {
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitHistoryCategory = @(
@{
Name = 'Breaking'
Title = 'Breaking'
Name = @(
'Breaking'
'breaking-change'
)
}
@{
Name = 'Feature'
Title = 'Features'
Name = @(
'Feature'
'feat'
)
}
@{
Name = 'Enhancement'
Title = 'Enhancements'
Name = @(
'Enhancement'
)
}
@{
Name = 'Change'
Title = 'Change'
Name = @(
'Change'
)
}
@{
Name = 'Refactor'
Title = 'Refactors'
Name = @(
'Refactor'
)
}
@{
Name = 'CI'
Title = 'CI'
Name = @(
'CI'
)
}
@{
Name = 'Test'
Title = 'Tests'
Name = @(
'Test'
)
}
@{
Name = 'Fix'
Title = 'Fixes'
Name = @(
'Fix'
)
}
@{
Name = 'Style'
Title = 'Style'
Name = @(
'Style'
)
}
@{
Name = 'Docs'
Title = 'Documentation'
Name = @(
'Docs'
)
}
@{
Name = 'Chore'
Title = 'Chore'
Name = @(
'Chore'
)
}
)
$commitHistoryCategoryNone = @{
Expand All @@ -75,7 +99,7 @@ function Changes-HashSubject-NoMerges-CategorizedSorted {
$commitHistoryCategorizedCollection = New-Object System.Collections.ArrayList
$commitHistoryUncategorizedCollection = New-Object System.Collections.ArrayList
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*\w+\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if ($_ -match "^[0-9a-f]+ (\s*[a-zA-Z0-9_\-]+\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
$commitHistoryCategorizedCollection.Add($_) > $null
}else {
$commitHistoryUncategorizedCollection.Add($_) > $null
Expand Down Expand Up @@ -106,18 +130,21 @@ function Changes-HashSubject-NoMerges-CategorizedSorted {
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCategorizedCustomCollection | Sort-Object -Property Subject | % {
if ("$($_.Ref) $($_.Subject)" -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if (!$iscommitHistoryCategoryTitleOutputted) {
foreach ($n in $c['Name']) {
if ("$($_.Ref) $($_.Subject)" -match "^[0-9a-f]+ (\s*$n\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$iscommitHistoryCategoryTitleOutputted = $true
}
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $($_.Ref) $($_.Subject)
"@
break
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,72 @@ function Changes-HashSubjectAuthor-NoMerges-Categorized {
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$commitHistoryCategory = @(
@{
Name = 'Breaking'
Title = 'Breaking'
Name = @(
'Breaking'
'breaking-change'
)
}
@{
Name = 'Feature'
Title = 'Features'
Name = @(
'Feature'
'feat'
)
}
@{
Name = 'Enhancement'
Title = 'Enhancements'
Name = @(
'Enhancement'
)
}
@{
Name = 'Change'
Title = 'Change'
Name = @(
'Change'
)
}
@{
Name = 'Refactor'
Title = 'Refactors'
Name = @(
'Refactor'
)
}
@{
Name = 'CI'
Title = 'CI'
Name = @(
'CI'
)
}
@{
Name = 'Test'
Title = 'Tests'
Name = @(
'Test'
)
}
@{
Name = 'Fix'
Title = 'Fixes'
Name = @(
'Fix'
)
}
@{
Name = 'Style'
Title = 'Style'
Name = @(
'Style'
)
}
@{
Name = 'Docs'
Title = 'Documentation'
Name = @(
'Docs'
)
}
@{
Name = 'Chore'
Title = 'Chore'
Name = @(
'Chore'
)
}
)
$commitHistoryCategoryNone = @{
Expand All @@ -75,7 +99,7 @@ function Changes-HashSubjectAuthor-NoMerges-Categorized {
$commitHistoryCategorizedCollection = New-Object System.Collections.ArrayList
$commitHistoryUncategorizedCollection = New-Object System.Collections.ArrayList
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*\w+\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if ($_ -match "^[0-9a-f]+ (\s*[a-zA-Z0-9_\-]+\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
$commitHistoryCategorizedCollection.Add($_) > $null
}else {
$commitHistoryUncategorizedCollection.Add($_) > $null
Expand All @@ -88,18 +112,21 @@ function Changes-HashSubjectAuthor-NoMerges-Categorized {
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
$commitHistoryCollection | % {
if ($_ -match "^[0-9a-f]+ (\s*$($c['Name'])\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if (!$iscommitHistoryCategoryTitleOutputted) {
foreach ($n in $c['Name']) {
if ($_ -match "^[0-9a-f]+ (\s*$n\s*)(\(\s*[a-zA-Z0-9_\-\/]+\s*\)\s*)*:(.+)") {
if (!$iscommitHistoryCategoryTitleOutputted) {
@"
### $($c['Title'])
"@
$iscommitHistoryCategoryTitleOutputted = $true
}
$iscommitHistoryCategoryTitleOutputted = $true
}
@"
* $_
"@
break
}
}
}
}
Expand Down
Loading

0 comments on commit 1e1ff01

Please sign in to comment.