Skip to content

Commit f15d11c

Browse files
committed
create PR only after codes and samples are generated
- expand the steps of generating codes and samples, move PR creation into a separate job which is executed only after success codes/sample generation - remove `-f` for git push - change push branch to have version as name suffix to avoid potential conflict
1 parent 290a3e1 commit f15d11c

File tree

1 file changed

+35
-14
lines changed

1 file changed

+35
-14
lines changed

eng/pipelines/build.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,13 @@ stages:
183183
failOnStderr: false
184184
workingDirectory: $(Build.SourcesDirectory)/autorest.csharp
185185
displayName: 'Update SDK codes and generator version in Azure SDK repo'
186-
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml@azure-sdk-tools
186+
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml@azure-sdk-tools
187187
parameters:
188-
BaseBranchName: main
189-
RepoName: azure-sdk-for-net
190-
PRBranchName: auto-update-autorest
188+
BaseRepoBranch: auto-update-autorest-$(AutorestCSharpVersion)
189+
BaseRepoOwner: azure-sdk
191190
CommitMsg: Update AutoRest C# version to $(AutorestCSharpVersion)
192-
PRBody: Update AutoRest C# version to $(AutorestCSharpVersion)
193-
PRTitle: Update AutoRest C# version
194-
PushArgs: -f
191+
TargetRepoOwner: Azure
192+
TargetRepoName: $(Build.Repository.Name)
195193
WorkingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-net
196194
ScriptDirectory: $(Build.SourcesDirectory)/azure-sdk-tools/eng/common/scripts
197195
- job: Update_Samples
@@ -214,14 +212,37 @@ stages:
214212
failOnStderr: false
215213
workingDirectory: $(Build.SourcesDirectory)/autorest.csharp
216214
displayName: 'Update sample codes and generator version in Azure SDK repo'
217-
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml@azure-sdk-tools
215+
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml@azure-sdk-tools
218216
parameters:
219-
BaseBranchName: main
220-
RepoName: azure-sdk-for-net
221-
PRBranchName: auto-update-autorest
217+
BaseRepoBranch: auto-update-autorest-$(AutorestCSharpVersion)
218+
BaseRepoOwner: azure-sdk
222219
CommitMsg: Update AutoRest C# version to $(AutorestCSharpVersion)
223-
PRBody: Update AutoRest C# version to $(AutorestCSharpVersion)
224-
PRTitle: Update AutoRest C# version
225-
PushArgs: -f
220+
TargetRepoOwner: Azure
221+
TargetRepoName: $(Build.Repository.Name)
226222
WorkingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-net
227223
ScriptDirectory: $(Build.SourcesDirectory)/azure-sdk-tools/eng/common/scripts
224+
- job: Create_PR
225+
dependsOn:
226+
- Update_Codes
227+
- Update_Samples
228+
variables:
229+
AutorestCSharpVersion: $[stageDependencies.Build_and_Test.Build.outputs['Package.AutorestCSharpVersion']]
230+
CadlEmitterVersion: $[stageDependencies.Build_and_Test.Build.outputs['Publish.CadlEmitterVersion']]
231+
steps:
232+
- checkout: self
233+
- checkout: azure-sdk-tools
234+
- task: PowerShell@2
235+
displayName: Create pull request
236+
condition: and(succeeded(), eq(variables['HasChanges'], 'true'))
237+
inputs:
238+
pwsh: true
239+
filePath: $(Build.SourcesDirectory)/azure-sdk-tools/eng/common/scripts/Submit-PullRequest.ps1
240+
arguments: >
241+
-RepoOwner "Azure"
242+
-RepoName "$(RepoNameWithoutOwner)"
243+
-BaseBranch "main"
244+
-PROwner "azure-sdk"
245+
-PRBranch "auto-update-autorest-$(AutorestCSharpVersion)"
246+
-AuthToken "$(azuresdk-github-pat)"
247+
-PRTitle "Update AutoRest C# version"
248+
-PRBody "$Update AutoRest C# version to $(AutorestCSharpVersion)"

0 commit comments

Comments
 (0)