Skip to content

Commit

Permalink
Refactor (generate): Standardize ref parameter for generate functions
Browse files Browse the repository at this point in the history
  • Loading branch information
joeltimothyoh committed Jul 28, 2024
1 parent afe4fbd commit c94bec0
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Generate-ReleaseNotes {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
,
[Parameter(Mandatory=$true)]
[ValidateSet(
Expand Down Expand Up @@ -44,7 +44,7 @@ function Generate-ReleaseNotes {
try {
$private:generateArgs = @{
Path = $Path
TagName = $TagName
Ref = $Ref
}
"Generating release notes of variant '$($Variant)'" | Write-Verbose
$releaseNotesContent = & $Variant @private:generateArgs -ErrorAction Stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubject-Merges {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
Merges = $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubject-NoMerges-Categorized {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
NoMerges = $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubject-NoMerges-CategorizedSorted {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
NoMerges = $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubject-NoMerges {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
NoMerges = $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubject {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
}
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubjectAuthor-NoMerges-Categorized {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s - `%aN`'
NoMerges = $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function Changes-HashSubjectAuthor-NoMerges-CategorizedSorted {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s - `%aN`'
NoMerges = $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-HashSubject-Merges {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
Merges = $true
}
Expand All @@ -25,7 +25,7 @@ function VersionDate-HashSubject-Merges {
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
$commitHistoryCollection | % {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-HashSubject-NoMerges-Categorized {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
NoMerges = $true
}
Expand Down Expand Up @@ -120,7 +120,7 @@ function VersionDate-HashSubject-NoMerges-Categorized {
}
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-HashSubject-NoMerges-CategorizedSorted {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
NoMerges = $true
}
Expand Down Expand Up @@ -138,7 +138,7 @@ function VersionDate-HashSubject-NoMerges-CategorizedSorted {
}
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-HashSubject-NoMerges {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
NoMerges = $true
}
Expand All @@ -25,7 +25,7 @@ function VersionDate-HashSubject-NoMerges {
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
$commitHistoryCollection | % {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ function VersionDate-HashSubject {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s'
}
if ($previousRelease) { $funcArgs['SecondRef'] = @($previousRelease)[0] }
$commitHistory = Get-RepositoryCommitHistory @funcArgs
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
$commitHistoryCollection | % {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-HashSubjectAuthor-NoMerges-Categorized {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s - `%aN`'
NoMerges = $true
}
Expand Down Expand Up @@ -120,7 +120,7 @@ function VersionDate-HashSubjectAuthor-NoMerges-Categorized {
}
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-HashSubjectAuthor-NoMerges-CategorizedSorted {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%h %s - `%aN`'
NoMerges = $true
}
Expand Down Expand Up @@ -140,7 +140,7 @@ function VersionDate-HashSubjectAuthor-NoMerges-CategorizedSorted {
}
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
foreach ($c in $commitHistoryCategory) {
$iscommitHistoryCategoryTitleOutputted = $false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ function VersionDate-Subject-Merges {
,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$TagName
[string]$Ref
)

$ErrorActionPreference = 'Stop'

try {
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $TagName -ErrorAction SilentlyContinue
$previousRelease = Get-RepositoryReleasePrevious -Path $Path -Ref $Ref -ErrorAction SilentlyContinue
$funcArgs = @{
Path = $Path
FirstRef = $TagName
FirstRef = $Ref
PrettyFormat = '%s'
Merges = $true
}
Expand All @@ -25,7 +25,7 @@ function VersionDate-Subject-Merges {
$commitHistoryCollection = $commitHistory -split "`n" | % { $_.Trim() } | ? { $_ }
$releaseBody = & {
@"
## $TagName ($(Get-Date -UFormat '%Y-%m-%d'))
## $Ref ($(Get-Date -UFormat '%Y-%m-%d'))
"@
$commitHistoryCollection | % {
Expand Down
Loading

0 comments on commit c94bec0

Please sign in to comment.