Skip to content

Commit ab065cb

Browse files
committed
fix small issues
1 parent d9dc34c commit ab065cb

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.azure-pipelines/PipelineSteps/BatchGeneration/batch-generate-modules.ps1

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,25 @@ foreach ($moduleName in $sortedModuleNames) {
8787
if ($diff) {
8888
Write-Host "Changes detected in $moduleName, adding change log"
8989
$moduleResult.Changed = "Yes"
90+
91+
$date = Get-Date -Format "yy-MM-dd"
92+
$newChangeLogEntry = "* Autorest version: $AutorestVersion - $date"
93+
94+
$updatedContent = @()
9095
$changeLogPath = Join-Path $RepoRoot "src" $moduleName $moduleName "AutorestUpgradeLog.md"
96+
9197
if (-not (Test-Path $changeLogPath)) {
9298
New-Item -Path $changeLogPath -ItemType File -Force | Out-Null
93-
Add-Content -Path $changeLogPath -Value "## Autorest upgrade log"
99+
$updatedContent += "## Autorest upgrade log"
100+
$updatedContent += $newChangeLogEntry
101+
} else{
102+
$changeLogContent = Get-Content -Path $changeLogPath
103+
$updatedContent += $changeLogContent[0]
104+
$updatedContent += $newChangeLogEntry
105+
$updatedContent += $changeLogContent[1..($changeLogContent.Count - 1)]
94106
}
95-
$changeLogContent = Get-Content -Path $changeLogPath
96-
$date = Get-Date -Format "dd/MM/yy"
97-
$newChangeLogEntry = "* Autorest version: $AutorestVersion - $date"
98-
$changeLogContent.Insert(1, $newChangeLogEntry)
99-
Set-Content $changeLogPath -Value $changeLogContent
107+
Set-Content $changeLogPath -Value $updatedContent
108+
100109
$moduleResult.Changed = "Yes, Autorest Change Log Updated"
101110
Write-Host "New change log entry added to $changeLogPath"
102111
}

.azure-pipelines/PipelineSteps/BatchGeneration/notify-failed-job.ps1

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ param (
55
$utilFilePath = Join-Path $RepoRoot '.azure-pipelines' 'PipelineSteps' 'BatchGeneration' 'util.psm1'
66
Import-Module $utilFilePath -Force
77

8-
$batchGenSubscribers = @(
9-
10-
11-
12-
)
13-
$receivers = $batchGenSubscribers -join ","
14-
158
$pipelineName = $env:BUILD_DEFINITIONNAME
169
$pipelineUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$($env:SYSTEM_TEAMPROJECT)/_build?definitionId=$($env:SYSTEM_DEFINITIONID)"
1710
$runUrl = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$($env:SYSTEM_TEAMPROJECT)/_build/results?buildId=$($env:BUILD_BUILDID)"
@@ -23,6 +16,6 @@ $notificationContent = $notificationTemplate -replace "{{ pipelineName }}", $pip
2316
-replace "{{ runUrl }}", $runUrl
2417

2518
Send-Teams `
26-
-to $receivers `
19+
-to $(FailedJobNotificationReceivers) `
2720
-title "Batch Generation Job Failed" `
2821
-content $notificationContent

.azure-pipelines/batch-generation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ parameters:
22
- name: AutorestVersion
33
displayName: 'Version of Autorest that trigger batch generation'
44
type: string
5-
default: 'Default version'
5+
default: '4.x.x'
66

77
variables:
88
IntermediateStepTimeoutInMinutes: 30
@@ -52,7 +52,7 @@ stages:
5252
$token = "$(GitHubToken)"
5353
5454
$createBranchPath = Join-Path "$(Build.SourcesDirectory)" '.azure-pipelines' 'PipelineSteps' 'BatchGeneration' 'create-branch.ps1'
55-
& $createBranchPath -Owner 'Azure' -Repo 'azure-powershell' -BaseBranch 'main' -NewBranch $generationBranch -Token $token
55+
& $createBranchPath -Owner 'Azure' -Repo 'azure-powershell' -BaseBranch "$(GenerationBaseBranch)" -NewBranch $generationBranch -Token $token
5656
Write-Host "##vso[task.setvariable variable=GenerationBranch;isOutput=true]$generationBranch"
5757
5858
- task: PowerShell@2

0 commit comments

Comments
 (0)