Skip to content

Commit 0c85911

Browse files
JoshLove-msftazure-sdk
authored andcommitted
open as draft logic and fix emitter version
1 parent 7086210 commit 0c85911

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ extends:
100100

101101
- task: PowerShell@2
102102
displayName: 'Run initialize script'
103+
name: initialize
103104
inputs:
104105
pwsh: true
105106
filePath: $(Build.SourcesDirectory)/eng/scripts/typespec/Initialize-WorkingDirectory.ps1
@@ -117,7 +118,6 @@ extends:
117118
118119
- task: PowerShell@2
119120
displayName: 'Run build script'
120-
name: ci_build
121121
inputs:
122122
pwsh: true
123123
filePath: $(Build.SourcesDirectory)/eng/scripts/typespec/Build-Emitter.ps1
@@ -206,7 +206,6 @@ extends:
206206

207207
# Regenerate stage
208208
# Responsible for regenerating the SDK code using the emitter package and the generation matrix.
209-
# Creates a pull request to the `main` branch with the regened changes and updated emitter-package and emitter-package-lock files.
210209
- ${{ if and(parameters.ShouldPublish, parameters.ShouldRegenerate) }}:
211210
- stage: Regenerate
212211
dependsOn:
@@ -327,7 +326,7 @@ extends:
327326
- Generate
328327
variables:
329328
generateJobResult: $[dependencies.Generate.result]
330-
emitterVersion: $[stageDependencies.Build.Build.outputs['ci_build.emitterVersion']]
329+
emitterVersion: $[stageDependencies.Build.Build.outputs['initialize.emitterVersion']]
331330
steps:
332331
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
333332

@@ -387,6 +386,16 @@ extends:
387386
} else {
388387
Write-Error "Build.Repository.Name not in the expected {Owner}/{Name} format"
389388
}
389+
390+
$openAsDraft = -not ($reason -eq 'IndividualCI' -and $sourceBranch -eq 'refs/heads/main')
391+
Write-Host "Setting OpenAsDraftBool = $openAsDraft"
392+
Write-Host "##vso[task.setvariable variable=OpenAsDraft]$openAsDraft"
393+
if ($openAsDraft) {
394+
Write-Host "##vso[task.setvariable variable=PRLabels]Do Not Merge"
395+
} else {
396+
Write-Host "##vso[task.setvariable variable=PRLabels]"
397+
}
398+
390399
displayName: Get PR title and body
391400
392401
- task: PowerShell@2
@@ -403,8 +412,8 @@ extends:
403412
-AuthToken '$(azuresdk-github-pat)'
404413
-PRTitle '$(PullRequestTitle)'
405414
-PRBody '$(PullRequestBody)'
406-
-OpenAsDraft $true
407-
-PRLabels 'Do Not Merge'
415+
-OpenAsDraft $$(OpenAsDraft)
416+
-PRLabels '$(PRLabels)'
408417
workingDirectory: $(Build.SourcesDirectory)
409418

410419
# Test stage

0 commit comments

Comments
 (0)