Skip to content

Commit 29421f9

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 d41c8be commit 29421f9

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
@@ -179,15 +179,13 @@ stages:
179179
failOnStderr: false
180180
workingDirectory: $(Build.SourcesDirectory)/autorest.csharp
181181
displayName: 'Update SDK codes and generator version in Azure SDK repo'
182-
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml@azure-sdk-tools
182+
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml@azure-sdk-tools
183183
parameters:
184-
BaseBranchName: main
185-
RepoName: azure-sdk-for-net
186-
PRBranchName: auto-update-autorest
184+
BaseRepoBranch: auto-update-autorest-$(AutorestCSharpVersion)
185+
BaseRepoOwner: azure-sdk
187186
CommitMsg: Update AutoRest C# version to $(AutorestCSharpVersion)
188-
PRBody: Update AutoRest C# version to $(AutorestCSharpVersion)
189-
PRTitle: Update AutoRest C# version
190-
PushArgs: -f
187+
TargetRepoOwner: Azure
188+
TargetRepoName: $(Build.Repository.Name)
191189
WorkingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-net
192190
ScriptDirectory: $(Build.SourcesDirectory)/azure-sdk-tools/eng/common/scripts
193191
- job: Update_Samples
@@ -210,14 +208,37 @@ stages:
210208
failOnStderr: false
211209
workingDirectory: $(Build.SourcesDirectory)/autorest.csharp
212210
displayName: 'Update sample codes and generator version in Azure SDK repo'
213-
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml@azure-sdk-tools
211+
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml@azure-sdk-tools
214212
parameters:
215-
BaseBranchName: main
216-
RepoName: azure-sdk-for-net
217-
PRBranchName: auto-update-autorest
213+
BaseRepoBranch: auto-update-autorest-$(AutorestCSharpVersion)
214+
BaseRepoOwner: azure-sdk
218215
CommitMsg: Update AutoRest C# version to $(AutorestCSharpVersion)
219-
PRBody: Update AutoRest C# version to $(AutorestCSharpVersion)
220-
PRTitle: Update AutoRest C# version
221-
PushArgs: -f
216+
TargetRepoOwner: Azure
217+
TargetRepoName: $(Build.Repository.Name)
222218
WorkingDirectory: $(Build.SourcesDirectory)/azure-sdk-for-net
223219
ScriptDirectory: $(Build.SourcesDirectory)/azure-sdk-tools/eng/common/scripts
220+
- job: Create_PR
221+
dependsOn:
222+
- Update_Codes
223+
- Update_Samples
224+
variables:
225+
AutorestCSharpVersion: $[stageDependencies.Build_and_Test.Build.outputs['Package.AutorestCSharpVersion']]
226+
CadlEmitterVersion: $[stageDependencies.Build_and_Test.Build.outputs['Publish.CadlEmitterVersion']]
227+
steps:
228+
- checkout: self
229+
- checkout: azure-sdk-tools
230+
- task: PowerShell@2
231+
displayName: Create pull request
232+
condition: and(succeeded(), eq(variables['HasChanges'], 'true'))
233+
inputs:
234+
pwsh: true
235+
filePath: $(Build.SourcesDirectory)/azure-sdk-tools/eng/common/scripts/Submit-PullRequest.ps1
236+
arguments: >
237+
-RepoOwner "Azure"
238+
-RepoName "$(RepoNameWithoutOwner)"
239+
-BaseBranch "main"
240+
-PROwner "azure-sdk"
241+
-PRBranch "auto-update-autorest-$(AutorestCSharpVersion)"
242+
-AuthToken "$(azuresdk-github-pat)"
243+
-PRTitle "Update AutoRest C# version"
244+
-PRBody "$Update AutoRest C# version to $(AutorestCSharpVersion)"

0 commit comments

Comments
 (0)