3737)
3838
3939# Set up variables for the PR
40+ # Track if any warnings were encountered during execution
41+ $WarningsEncountered = $false
4042$RepoOwner = " openai"
4143$RepoName = " openai-dotnet"
4244$BaseBranch = " main"
@@ -50,6 +52,8 @@ function Write-Log {
5052function Write-Warning-Log {
5153 param ([string ]$Message )
5254 Write-Host " $ ( Get-Date - Format ' yyyy-MM-dd HH:mm:ss' ) : WARNING: $Message " - ForegroundColor Yellow
55+ # Set the global warning flag to track that warnings occurred
56+ $script :WarningsEncountered = $true
5357}
5458
5559function Write-Error-Log {
@@ -251,7 +255,11 @@ Update @typespec/http-client-csharp to $PackageVersion
251255 Write-Log " Creating PR using GitHub CLI"
252256 $env: GH_TOKEN = $AuthToken
253257
258+ # Update PR title if warnings were encountered
254259 $prTitle = " Update @typespec/http-client-csharp to $PackageVersion "
260+ if ($WarningsEncountered ) {
261+ $prTitle = " Succeeded with Issues: $prTitle "
262+ }
255263 $prBody = @"
256264This PR automatically updates the TypeSpec HTTP client C# generator version and regenerates the SDK code.
257265
@@ -285,6 +293,12 @@ If there are any issues with the generated code, please review the [TypeSpec rel
285293 }
286294
287295 Write-Log " Successfully created PR: $prUrl "
296+ # If warnings were encountered, make the script exit with non-zero code
297+ # This will mark the GitHub Action step as failed but still create the PR
298+ if ($WarningsEncountered ) {
299+ Write-Warning - Log " Warnings were encountered during execution. PR was created but marking step as failed."
300+ exit 1
301+ }
288302
289303} catch {
290304 Write-Error - Log " Error creating PR: $_ "
0 commit comments