mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This update improves the release notes generation process by restructuring documentation for clarity and enhancing workflows. It introduces new tools for handling GitHub issue images and attachments, along with automated tests to ensure functionality. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: N/A - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [x] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [x] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: N/A <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments The changes include updates to the release notes summarization process and workflow documentation for better clarity. New scripts for managing PR diffs, grouping, and milestone assignments have been added. Additionally, tools for downloading images and attachments from GitHub issues have been implemented, ensuring a more streamlined process. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Automated tests were added for the new GitHub issue tools, and all tests passed successfully. Manual validation included testing the new workflows and ensuring the documentation accurately reflects the changes made. ```
86 lines
3.3 KiB
PowerShell
86 lines
3.3 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Group PR rows by their Labels column and emit per-label CSV files.
|
|
|
|
.DESCRIPTION
|
|
Reads a milestone PR CSV (usually produced by dump-prs-information / dump-prs-since-commit scripts),
|
|
splits rows by label list, normalizes/sorts individual labels, and writes one CSV per unique label combination.
|
|
Each output preserves the original row ordering within that subset and column order from the source.
|
|
|
|
.PARAMETER CsvPath
|
|
Input CSV containing PR rows with a 'Labels' column (comma-separated list).
|
|
|
|
.PARAMETER OutDir
|
|
Output directory to place grouped CSVs (created if missing). Default: 'grouped_csv'.
|
|
|
|
.NOTES
|
|
Label combinations are joined using ' | ' when multiple labels present. Filenames are sanitized (invalid characters,
|
|
whitespace collapsed) and truncated to <= 120 characters.
|
|
#>
|
|
param(
|
|
[string]$CsvPath = "sorted_prs.csv",
|
|
[string]$OutDir = "grouped_csv"
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
function Write-Info($msg) { Write-Host "[info] $msg" -ForegroundColor Cyan }
|
|
function Write-Warn($msg) { Write-Host "[warn] $msg" -ForegroundColor Yellow }
|
|
|
|
if (-not (Test-Path -LiteralPath $CsvPath)) { throw "CSV not found: $CsvPath" }
|
|
|
|
Write-Info "Reading CSV: $CsvPath"
|
|
$rows = Import-Csv -LiteralPath $CsvPath
|
|
Write-Info ("Loaded {0} rows" -f $rows.Count)
|
|
|
|
function ConvertTo-SafeFileName {
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory=$true)][string]$Name
|
|
)
|
|
if ([string]::IsNullOrWhiteSpace($Name)) { return 'Unnamed' }
|
|
$s = $Name -replace '[<>:"/\\|?*]', '-' # invalid path chars
|
|
$s = $s -replace '\s+', '-' # spaces to dashes
|
|
$s = $s -replace '-{2,}', '-' # collapse dashes
|
|
$s = $s.Trim('-')
|
|
if ($s.Length -gt 120) { $s = $s.Substring(0,120).Trim('-') }
|
|
if ([string]::IsNullOrWhiteSpace($s)) { return 'Unnamed' }
|
|
return $s
|
|
}
|
|
|
|
# Build groups keyed by normalized, sorted label combinations. Preserve original CSV row order.
|
|
$groups = @{}
|
|
foreach ($row in $rows) {
|
|
$labelsRaw = $row.Labels
|
|
if ([string]::IsNullOrWhiteSpace($labelsRaw)) {
|
|
$labelParts = @('Unlabeled')
|
|
} else {
|
|
$parts = $labelsRaw -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ }
|
|
if (-not $parts -or $parts.Count -eq 0) { $labelParts = @('Unlabeled') }
|
|
else { $labelParts = $parts | Sort-Object }
|
|
}
|
|
|
|
$key = ($labelParts -join ' | ')
|
|
if (-not $groups.ContainsKey($key)) { $groups[$key] = New-Object System.Collections.ArrayList }
|
|
[void]$groups[$key].Add($row)
|
|
}
|
|
|
|
if (-not (Test-Path -LiteralPath $OutDir)) {
|
|
Write-Info "Creating output directory: $OutDir"
|
|
New-Item -ItemType Directory -Path $OutDir | Out-Null
|
|
}
|
|
|
|
Write-Info ("Generating {0} grouped CSV file(s) into: {1}" -f $groups.Count, $OutDir)
|
|
|
|
foreach ($key in $groups.Keys) {
|
|
$labelParts = if ($key -eq 'Unlabeled') { @('Unlabeled') } else { $key -split '\s\|\s' }
|
|
$safeName = ($labelParts | ForEach-Object { ConvertTo-SafeFileName -Name $_ }) -join '-'
|
|
$filePath = Join-Path $OutDir ("$safeName.csv")
|
|
|
|
# Keep same columns and order
|
|
$groups[$key] | Export-Csv -LiteralPath $filePath -NoTypeInformation -Encoding UTF8
|
|
}
|
|
|
|
Write-Info "Done. Sample output files:"
|
|
Get-ChildItem -LiteralPath $OutDir | Select-Object -First 10 Name | Format-Table -HideTableHeaders
|