From 8d27ce2148b8cc8c1316a7f568616a4a99a51bc8 Mon Sep 17 00:00:00 2001 From: praveenkuttappan <55455725+praveenkuttappan@users.noreply.github.com> Date: Wed, 2 Feb 2022 13:41:54 -0500 Subject: [PATCH] Include instructions to upgrade package dependency in auto filed issues (#20099) * Update issue description and labels for package dependency upgrade issues --- eng/scripts/check-external-dependency.ps1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/eng/scripts/check-external-dependency.ps1 b/eng/scripts/check-external-dependency.ps1 index 4a4cc9fcc8e..ddeaf63f662 100644 --- a/eng/scripts/check-external-dependency.ps1 +++ b/eng/scripts/check-external-dependency.ps1 @@ -13,6 +13,7 @@ param ( # This script will reset the repo and any changes in tracked files will be lost. $dependencyUpgradeLabel = "dependency-upgrade-required" +$deprecatedDependency = "Deprecated-Dependency" $dependencyRegex = "^\+\s(?[\S]*)\s(?[\S]*)\s\((?[0-9\.a-b]*).*\)\s?(?deprecated)?" $RepoRoot = Resolve-Path -Path "${PSScriptRoot}/../.." Write-Host "Repo root: $RepoRoot" @@ -39,17 +40,24 @@ function Get-GithubIssue($IssueTitle) { function Set-GitHubIssue($Package) { $pkgName = $Package.Name $issueTitle = "Dependency package $pkgName has a new version available" - $issueDesc = "We have identified a dependency on $pkgName ($($Package.OldVersion)). " - + $issueDesc = "We have identified a dependency on version $($Package.OldVersion) of $pkgName. " + $labels = $dependencyUpgradeLabel if ($Package.IsDeprecated) { $issueDesc += "Version $($Package.OldVersion) of $pkgName has been deprecated.`n" + $labels += ",$deprecatedDependency" } - $issueDesc += "A new version ($($Package.NewVersion)) is available now." + $issueDesc += "A new version ($($Package.NewVersion)) is available for upgrade.`n`nFollowing are the steps to upgrade package dependency.`n + 1. Understand the breaking changes between the version being used and the version you want to upgrade to.`n + 2. Identify all packages that take a dependency on this package.`n + 3. Go to the root folder for each such package (/sdk/service-name/package-name) and update package.json to have the new version.`n + 4. Run rush update to ensure the new version is pulled in.`n + 5. Make relevant changes to absorb the breaking changes.`n + 6. Repeat steps 3 to 5 for each of the packages that have a dependency on this package." $issue = Get-GithubIssue -IssueTitle $issueTitle if ($issue) { if ($issue.body -ne $issueDesc) { - $oldIssue = Update-GitHubIssue -RepoOwner $RepoOwner -RepoName $RepoName -AuthToken $AuthToken -IssueNumber $issue.number -Body $issueDesc + $oldIssue = Update-GitHubIssue -RepoOwner $RepoOwner -RepoName $RepoName -AuthToken $AuthToken -IssueNumber $issue.number -Body $issueDesc -Labels $labels Write-Host "Updated existing issue $($oldIssue.number)" } else { @@ -60,7 +68,7 @@ function Set-GitHubIssue($Package) { write-Host "Creating issue for $pkgName" $newIssue = New-GitHubIssue -RepoOwner $RepoOwner -RepoName $RepoName -AuthToken $AuthToken -Title $issueTitle -Description $issueDesc if ($newIssue) { - $out = Add-GitHubIssueLabels -RepoOwner $RepoOwner -RepoName $RepoName -AuthToken $AuthToken -Labels $dependencyUpgradeLabel -IssueNumber $newIssue.number + $out = Add-GitHubIssueLabels -RepoOwner $RepoOwner -RepoName $RepoName -AuthToken $AuthToken -Labels $labels -IssueNumber $newIssue.number } } }