Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
param(
[Parameter(Mandatory=$true)]
[string]$autorestVersion,

[Parameter(Mandatory=$true)]
[string]$changeLogEntry
)
Comment on lines +1 to +7
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script header is missing the shebang line and synopsis documentation. According to PowerShell cross-platform guidelines, all scripts should begin with #!/usr/bin/env pwsh and include a .SYNOPSIS section describing the script's purpose.

Copilot generated this review using guidance from repository custom instructions.

Write-Host "Script started"
$root = "src"

Get-ChildItem -Path $root -Directory | ForEach-Object {
$moduleOuter = $_.FullName
$moduleInner = Join-Path $moduleOuter $_.Name

$upgradeLog = Join-Path $moduleInner "AutorestUpgradeLog.md"
$changeLog = Join-Path $moduleInner "ChangeLog.md"

Write-Host $upgradeLog

if (-not (Test-Path $upgradeLog)) {
return
}

$lines = Get-Content $upgradeLog
$lastLine = ($lines | Select-Object -Last 1).Trim()

if ($lastLine -ne $autorestVersion) {
return
}


if (Test-Path $changeLog) {

$cl = Get-Content $changeLog

$index = -1
for ($i = 0; $i -lt $cl.Count; $i++) {
if ($cl[$i] -match '^## Upcoming Release$') {
$index = $i
break
}
}

if ($index -ge 0) {
$before = $cl[0..$index]
$after = $cl[($index+1)..($cl.Length-1)]
$new = $before + $changeLogEntry + "" + $after
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty string \"\" concatenation is unclear. This should be replaced with an explicit array element to improve readability, such as adding a blank line element to the array.

Suggested change
$new = $before + $changeLogEntry + "" + $after
$new = $before + @($changeLogEntry, "") + $after

Copilot uses AI. Check for mistakes.
} else {
$new = @("## Upcoming Release", $changeLogEntry, "") + $cl
}

Set-Content -Path $changeLog -Value $new

} else {
$content = @(
"## Upcoming Release",
$changeLogEntry,
""
)
Set-Content -Path $changeLog -Value $content
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down Expand Up @@ -370,8 +369,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down Expand Up @@ -784,8 +782,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down Expand Up @@ -1172,8 +1169,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ begin {

$context = Get-AzContext
if (-not $context -and -not $testPlayback) {
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
exit
throw "No Azure login detected. Please run 'Connect-AzAccount' to log in."
}

if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
Expand Down
Loading
Loading