-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemove-DeprecatedLabels.ps1
More file actions
73 lines (56 loc) · 2.01 KB
/
Copy pathRemove-DeprecatedLabels.ps1
File metadata and controls
73 lines (56 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<#
.SYNOPSIS
Deletes deprecated labels from a GitHub repository.
.DESCRIPTION
Deletes labels that are no longer part of plan/LABEL_STRATEGY.md.
Run Convert-IssueLabels.ps1 first so existing issues are re-labelled before deletion.
Safe to run multiple times.
.PARAMETER Repo
The target repository in owner/repo format (e.g. markheydon/my-repo).
.EXAMPLE
./scripts/Remove-DeprecatedLabels.ps1 markheydon/my-repo
#>
[CmdletBinding(SupportsShouldProcess)]
param (
[Parameter(Mandatory, Position = 0)]
[string]$Repo
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
Write-Error "GitHub CLI (gh) could not be found. Please install it first."
exit 1
}
function Remove-DeprecatedLabel {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory)][string]$LabelName
)
if (-not $PSCmdlet.ShouldProcess($Repo, "Delete label '$LabelName'")) {
Write-Output "Skipped (WhatIf): $LabelName"
return
}
& gh label delete $LabelName --repo $Repo --yes 2>$null | Out-Null
if ($LASTEXITCODE -eq 0) {
Write-Output "Deleted: $LabelName"
}
else {
Write-Output "Skipped (not found): $LabelName"
}
}
Write-Output "Removing deprecated labels from $Repo..."
# --- Renamed labels (replacements already exist) ---
# dependency -> blocked
Remove-DeprecatedLabel -LabelName 'dependency'
# feedback required (space) -> feedback-required
Remove-DeprecatedLabel -LabelName 'feedback required'
# waiting details (old malformed name) -> waiting-for-details
Remove-DeprecatedLabel -LabelName 'waiting details'
# waiting for details (spaced variant) -> waiting-for-details
Remove-DeprecatedLabel -LabelName 'waiting for details'
# --- Superseded labels (replaced by 'story') ---
Remove-DeprecatedLabel -LabelName 'feature'
Remove-DeprecatedLabel -LabelName 'improvement'
Remove-DeprecatedLabel -LabelName 'spike'
Remove-DeprecatedLabel -LabelName 'technical'
Write-Output 'Done.'