Skip to content

Remove problematic [RepoNames] PowerShell class #4481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions tools/ReleaseTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function Update-Branch {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[string]$RepositoryName
)
Use-Repository -RepositoryName $RepositoryName -Script {
Expand All @@ -37,7 +36,6 @@ function Get-Bullets {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[string]$RepositoryName,

[Parameter(Mandatory, ValueFromPipeline)]
Expand Down Expand Up @@ -97,7 +95,7 @@ function Get-Bullets {

# NOTE: The URL matcher must be explicit because the body of a PR may
# contain other URLs with digits (like an image asset).
$IssueRegex = '(' + ($CloseKeywords -join '|') + ')\s+((https://github.com/PowerShell/(?<repo>(' + ([RepoNames]::Values -join '|') + '))/issues/)|#)(?<number>\d+)'
$IssueRegex = '(' + ($CloseKeywords -join '|') + ')\s+((https://github.com/PowerShell/(?<repo>(vscode-powershell|PowerShellEditorServices))/issues/)|#)(?<number>\d+)'
}

process {
Expand All @@ -112,7 +110,7 @@ function Get-Bullets {
$number = $Matches.number
$repo = $Matches.repo
# Handle links to issues in both repos, in both shortcode and URLs.
$name = [RepoNames]::Values | Where-Object { $repo -match $_ } | Select-Object -First 1
$name = ("vscode-powershell", "PowerShellEditorServices") | Where-Object { $repo -match $_ } | Select-Object -First 1
"$($name ?? $RepositoryName) #$number"
} else {
"$RepositoryName #$($_.number)"
Expand Down Expand Up @@ -141,7 +139,7 @@ function Update-Changelog {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[ValidateSet("vscode-powershell", "PowerShellEditorServices")]
[string]$RepositoryName,

[Parameter(Mandatory)]
Expand Down Expand Up @@ -228,7 +226,7 @@ function Update-Version {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[ValidateSet("vscode-powershell", "PowerShellEditorServices")]
[string]$RepositoryName
)
$Version = Get-Version -RepositoryName $RepositoryName
Expand Down Expand Up @@ -287,7 +285,7 @@ function New-ReleasePR {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[ValidateSet("vscode-powershell", "PowerShellEditorServices")]
[string]$RepositoryName
)
$Version = Get-Version -RepositoryName $RepositoryName
Expand Down Expand Up @@ -340,11 +338,10 @@ function New-Release {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[ValidateSet("vscode-powershell", "PowerShellEditorServices")]
[string]$RepositoryName,

[Parameter(Mandatory)]
[ValidateScript({ $_.StartsWith("v") })]
[string]$Version
)
# TODO: Automate rolling a preview to a stable release.
Expand All @@ -363,11 +360,9 @@ function New-ReleaseBundle {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateScript({ $_.StartsWith("v") })]
[string]$PsesVersion,

[Parameter(Mandatory)]
[ValidateScript({ $_.StartsWith("v") })]
[string]$VsceVersion
)
"PowerShellEditorServices", "vscode-powershell" | ForEach-Object {
Expand All @@ -391,7 +386,6 @@ function New-DraftRelease {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[string]$RepositoryName,

[Parameter()]
Expand Down
12 changes: 2 additions & 10 deletions tools/VersionTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

using namespace System.Management.Automation

class RepoNames : IValidateSetValuesGenerator {
# NOTE: This is super over-engineered, but it was fun.
static [string[]] $Values = "vscode-powershell", "PowerShellEditorServices"
[String[]] GetValidValues() { return [RepoNames]::Values }
}

$ChangelogFile = "CHANGELOG.md"

<#
Expand All @@ -21,7 +15,7 @@ function Use-Repository {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[ValidateSet("vscode-powershell", "PowerShellEditorServices")]
[string]$RepositoryName,

[Parameter(Mandatory)]
Expand Down Expand Up @@ -53,7 +47,6 @@ function Use-Repository {
function Get-FirstChangelog {
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[string]$RepositoryName
)
$Changelog = Use-Repository -RepositoryName $RepositoryName -Script {
Expand All @@ -75,7 +68,6 @@ function Get-FirstChangelog {
function Get-Version {
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[string]$RepositoryName
)
# NOTE: The first line should always be the header.
Expand Down Expand Up @@ -116,7 +108,7 @@ function Test-IsPreRelease {
function Test-VersionIsValid {
param(
[Parameter(Mandatory)]
[ValidateSet([RepoNames])]
[ValidateSet("vscode-powershell", "PowerShellEditorServices")]
[string]$RepositoryName,

[Parameter(Mandatory)]
Expand Down