@@ -47,6 +47,12 @@ The GitHub PR label that opts a merged PR into auto-release. Defaults to 'auto-r
4747. PARAMETER BaseBranch
4848The base branch a PR must have been merged into to qualify. Defaults to 'main'.
4949
50+ . PARAMETER PipelineUrl
51+ The URL of the pipeline run, used for logging or linking back to the pipeline. Defaults to empty.
52+
53+ . PARAMETER AzsdkExePath
54+ The path to the azsdk executable used for release operations. Defaults to the AZSDK environment variable.
55+
5056. OUTPUTS
5157Azure DevOps output variables (reference cross-stage via dependencies.<stage>.outputs['<job>.<step>.<name>']):
5258 - HasAutoReleaseArtifacts : 'true' if at least one declared package is releasable
6369 [string ] $Artifacts = $env: AUTORELEASE_ARTIFACTS ,
6470 [string ] $AuthToken = $env: GH_TOKEN ,
6571 [string ] $AutoReleaseLabel = ' auto-release' ,
66- [string ] $BaseBranch = ' main'
72+ [string ] $BaseBranch = ' main' ,
73+ [string ] $PipelineUrl = ' ' ,
74+ [string ] $AzsdkExePath = $env: AZSDK
6775)
6876
6977$ErrorActionPreference = ' Stop'
@@ -186,6 +194,40 @@ function Invoke-AutoReleaseResolution {
186194 Write-Host " [$name ] changed by PR $prLink -> releasable."
187195 Set-PipelineVariable - Name " ReleaseArtifact_$safeName " - Value ' true' - IsOutput
188196 $matchedArtifacts += $artifact
197+
198+ # Update release pending status and release pipeline URL in the release plan for this package.
199+ # release status is updated as "Released" when the package has been successfully released; here we are marking it as "Approval Pending" to indicate that the release is awaiting approval.
200+ try
201+ {
202+ if ($AzsdkExePath )
203+ {
204+ $sdkPullRequestUrl = $pr.html_url
205+ $cliArgs = @ (" release-plan" , " update-release-status" , " --package-name" , $name , " --language" , $LanguageDisplayName , " --status" , " Approval Pending" , " --sdk-pull-request" , $sdkPullRequestUrl )
206+ if ($PipelineUrl )
207+ {
208+ $cliArgs += @ (" --release-pipeline" , $PipelineUrl )
209+ }
210+ else
211+ {
212+ LogWarning " Pipeline URL is not set; Not setting release pipeline link for package '$name ' in release plan."
213+ }
214+
215+ & $AzsdkExePath @cliArgs
216+ if ($LASTEXITCODE -ne 0 )
217+ {
218+ # # Not all releases have a release plan. So we should not fail the script even if a release plan is missing.
219+ Write-Host " Failed to update release pending status for package '$name ' using azsdk. Exit code: $LASTEXITCODE "
220+ }
221+ }
222+ else
223+ {
224+ Write-Host " AzsdkExePath is not set; skipping release plan update for package '$name '."
225+ }
226+ }
227+ catch
228+ {
229+ Write-Host " Failed to update release pending status in release plan for package '$name '. $ ( $_.Exception.Message ) "
230+ }
189231 }
190232 else {
191233 Write-Host " [$name ] not changed by PR $prLink ."
0 commit comments