|
18 | 18 | [cmdletbinding()] |
19 | 19 |
|
20 | 20 | param( |
21 | | - $Level |
| 21 | + [ValidateSet("Public", "Internal")] |
| 22 | + [string] |
| 23 | + $Audience |
22 | 24 | , |
23 | 25 | [string] |
24 | 26 | $WorkDir |
|
53 | 55 |
|
54 | 56 | $CurrentBranch = $env:Build_SourceBranchName |
55 | 57 |
|
56 | | - $CommitCodes = @( |
57 | | - @{ |
58 | | - code = '🐛', '🚑', 'bf:', 'bug:', 'prob:' |
59 | | - description = 'Bugs, Problems' |
60 | | - DefaultAudience = 'all' |
61 | | - Order = 2 |
62 | | - }, @{ |
63 | | - code = '👌', '📦', '✨', 'new:', 'impr:' |
64 | | - description = 'New features, Improvements' |
65 | | - DefaultAudience = 'all' |
66 | | - Order = 1 |
67 | | - }, @{ |
68 | | - code = '👷♂️', '⚙', '✅', 'ci:', 'cfg:', 'adm:', '💚' |
69 | | - description = 'Configuration, Testing' |
70 | | - DefaultAudience = 'internal' |
71 | | - Order = 4 |
72 | | - }, @{ |
73 | | - code = '📝' |
74 | | - description = 'Documentation' |
75 | | - DefaultAudience = 'internal' |
76 | | - Order = 3 |
77 | | - }, @{ |
78 | | - code = '✏', '♻', '🎨', 'rf:', 'opt:' |
79 | | - description = 'Code Optimization, Refactoring' |
80 | | - DefaultAudience = 'all' |
81 | | - Order = 5 |
82 | | - }, @{ |
83 | | - code = 'Other' |
84 | | - description = 'Other' |
85 | | - DefaultAudience = 'all' |
86 | | - Order = 6 |
87 | | - } |
88 | | - ) |
89 | | - $Omit = 'RE:', 'Merged', 'azure-pipelines.yml edited online with Bitbucket' |
| 58 | + $config = Import-PowerShellDataFile -Path $PSScriptRoot/../PSGitChangeLog.Config.psd1 |
| 59 | + $Intents = $config.Intents |
| 60 | + |
| 61 | + $Omit = $config.Omit |
90 | 62 | } |
91 | 63 | Process { |
92 | 64 | If (!$ProjectName) { |
|
121 | 93 | #Skip output if match with Omit |
122 | 94 | If ($Omit | Where-Object { $Commit.Subject -match $_ }) { Continue } |
123 | 95 |
|
124 | | - $CommitCode = $CommitCodes.Code | Where-Object { $Commit.Subject -match $_ } | Select-Object -First 1 |
125 | | - If ( $null -eq $CommitCode) { |
126 | | - $CommitCode = 'Other' |
| 96 | + $IntentCode = $Intents.Code | Where-Object { $Commit.Subject -match $_ } | Select-Object -First 1 |
| 97 | + If ( $null -eq $IntentCode) { |
| 98 | + $IntentCode = 'Other' |
| 99 | + } |
| 100 | + $Intent = $Intents | Where-Object { $_.Code -contains $IntentCode } |
| 101 | + If ($Audience -eq 'Public' -and $Intent.DefaultAudience -eq 'internal') { |
| 102 | + Continue |
127 | 103 | } |
128 | 104 | If ($Commit.Subject.Length -lt $RequiredCommitMessageLength) { |
129 | 105 | Write-Host "Commit message: $message is considered too short ($RequiredCommitMessageLength). Ommitting from changelog..." |
|
136 | 112 | ReleaseVersionid = $TagSemVerId |
137 | 113 | ReleaseCommit = $TagCommit |
138 | 114 | ReleaseDate = $TagDate |
139 | | - IntentCode = $CommitCode |
140 | | - Intent = ($CommitCodes | Where-Object { $_.Code -contains $CommitCode }).Description |
141 | | - Audience = ($CommitCodes | Where-Object { $_.Code -contains $CommitCode }).DefaultAudience |
| 115 | + IntentCode = $IntentCode |
| 116 | + Intent = $Intent.Description |
| 117 | + Audience = $Intent.DefaultAudience |
142 | 118 | Message = $Commit.Subject |
143 | 119 | IssueKey = $IssueKey |
144 | 120 | CommitId = $Commit.CommitId |
145 | | - Order = ($CommitCodes | Where-Object { $_.Code -contains $CommitCode }).Order |
| 121 | + Order = $Intents.Order |
146 | 122 | } |
| 123 | + |
147 | 124 | Write-Output $log |
148 | 125 | } #ForEach |
149 | 126 |
|
|
0 commit comments