diff --git a/.azure-pipelines/SyncFromMainBranchConfig.json b/.azure-pipelines/SyncFromMainBranchConfig.json index 625077dc4aab..457ee1fe7ab8 100644 --- a/.azure-pipelines/SyncFromMainBranchConfig.json +++ b/.azure-pipelines/SyncFromMainBranchConfig.json @@ -8,7 +8,8 @@ "build.proj", "src/Az.Test.props", "src/Az.autorest.hybrid.props", - "src/psm1.props" + "src/psm1.props", + "NuGet.Config" ], "UnSyncPath": [ ".azure-pipelines/SyncFromMainBranchConfig.json" diff --git a/.azure-pipelines/code-gen.yml b/.azure-pipelines/code-gen.yml index b4193fa47eaf..ee41994b2af7 100644 --- a/.azure-pipelines/code-gen.yml +++ b/.azure-pipelines/code-gen.yml @@ -97,34 +97,9 @@ jobs: git push origin codegen/${{ parameters.ServiceName }} --force; displayName: Create codegen/${{ parameters.ServiceName }} branch - pwsh: | - $Headers = @{"Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $(BotAccessToken)"} - $PrBody = @' - - - ## Description - - - - ## Checklist - - - [x] Check this box to confirm: **I have read the [_Submitting Changes_](../blob/main/CONTRIBUTING.md#submitting-changes) section of [`CONTRIBUTING.md`](../blob/main/CONTRIBUTING.md) and reviewed the following information:** - - * **SHOULD** select appropriate branch. Cmdlets from Autorest.PowerShell should go to [`generation`](https://github.com/Azure/azure-powershell/tree/generation) branch. - * **SHOULD** make the title of PR clear and informative, and in the present imperative tense. - * **SHOULD** update `ChangeLog.md` file(s) appropriately - * For any service, the `ChangeLog.md` file can be found at `src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md` - * A snippet outlining the change(s) made in the PR should be written under the `## Upcoming Release` header in the past tense. Add changelog in description section if PR goes into [`generation`](https://github.com/Azure/azure-powershell/tree/generation) branch. - * Should **not** change `ChangeLog.md` if no new release is required, such as fixing test case only. - * **SHOULD** have approved design review for the changes in [this repository](https://github.com/Azure/azure-powershell-cmdlet-review-pr) ([_Microsoft internal only_](../blob/main/CONTRIBUTING.md#onboarding)) with following situations - * Create new module from scratch - * Create new resource types which are not easy to conform to [Azure PowerShell Design Guidelines](../blob/main/documentation/development-docs/design-guidelines) - * Create new resource type which name doesn't use module name as prefix - * Have design question before implementation - * **SHOULD** regenerate markdown help files if there is cmdlet API change. [Instruction](../blob/main/documentation/development-docs/help-generation.md#updating-all-markdown-files-in-a-module) - * **SHOULD** have proper test coverage for changes in pull request. - * **SHOULD NOT** introduce [breaking changes](../blob/main/documentation/breaking-changes/breaking-changes-definition.md) in Az minor release except preview version. - * **SHOULD NOT** adjust version of module manually in pull request - '@ - $RequestBody = @{"title" = "Migrate ${{ parameters.ServiceName }} from generation to ${{ parameters.TargetBranch }}"; "body" = $PrBody; "head" = "codegen/${{ parameters.ServiceName }}"; "base" = "${{ parameters.TargetBranch }}" } - Invoke-WebRequest -Uri https://api.github.com/repos/Azure/azure-powershell/pulls -method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json) + $Title = "Migrate ${{ parameters.ServiceName }} from generation to ${{ parameters.TargetBranch }}" + $HeadBranch = "codegen/${{ parameters.ServiceName }}" + $BaseBranch = "${{ parameters.TargetBranch }}" + $Description = "Migrate ${{ parameters.ServiceName }} from generation to ${{ parameters.TargetBranch }}" + ./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(BotAccessToken) -Description $Description displayName: Create PR to main branch diff --git a/.azure-pipelines/sync-tools-folder.yml b/.azure-pipelines/sync-tools-folder.yml index dbf309c5db53..c5840a947284 100644 --- a/.azure-pipelines/sync-tools-folder.yml +++ b/.azure-pipelines/sync-tools-folder.yml @@ -40,34 +40,9 @@ jobs: pwsh: true - pwsh: | - $Headers = @{"Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $(GithubToken)"} - $PrBody = @' - - - ## Description - - - - ## Checklist - - - [x] Check this box to confirm: **I have read the [_Submitting Changes_](../blob/main/CONTRIBUTING.md#submitting-changes) section of [`CONTRIBUTING.md`](../blob/main/CONTRIBUTING.md) and reviewed the following information:** - - * **SHOULD** select appropriate branch. Cmdlets from Autorest.PowerShell should go to [`generation`](https://github.com/Azure/azure-powershell/tree/generation) branch. - * **SHOULD** make the title of PR clear and informative, and in the present imperative tense. - * **SHOULD** update `ChangeLog.md` file(s) appropriately - * For any service, the `ChangeLog.md` file can be found at `src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md` - * A snippet outlining the change(s) made in the PR should be written under the `## Upcoming Release` header in the past tense. Add changelog in description section if PR goes into [`generation`](https://github.com/Azure/azure-powershell/tree/generation) branch. - * Should **not** change `ChangeLog.md` if no new release is required, such as fixing test case only. - * **SHOULD** have approved design review for the changes in [this repository](https://github.com/Azure/azure-powershell-cmdlet-review-pr) ([_Microsoft internal only_](../blob/main/CONTRIBUTING.md#onboarding)) with following situations - * Create new module from scratch - * Create new resource types which are not easy to conform to [Azure PowerShell Design Guidelines](../blob/main/documentation/development-docs/design-guidelines) - * Create new resource type which name doesn't use module name as prefix - * Have design question before implementation - * **SHOULD** regenerate markdown help files if there is cmdlet API change. [Instruction](../blob/main/documentation/development-docs/help-generation.md#updating-all-markdown-files-in-a-module) - * **SHOULD** have proper test coverage for changes in pull request. - * **SHOULD NOT** introduce [breaking changes](../blob/main/documentation/breaking-changes/breaking-changes-definition.md) in Az minor release except preview version. - * **SHOULD NOT** adjust version of module manually in pull request - '@ - $RequestBody = @{"title" = "Sync tools code from main branch to generation branch"; "body" = $PrBody; "head" = "syncToolsFolder-generation"; "base" = "generation" } - Invoke-WebRequest -Uri https://api.github.com/repos/Azure/azure-powershell/pulls -method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json) + $Title = "Sync tools code from main branch to generation branch" + $HeadBranch = "syncToolsFolder-$(BranchName)" + $BaseBranch = "$(BranchName)" + $Description = "Migrate Sync tools code from main branch to $(BranchName) branch" + ./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(GithubToken) -Description $Description displayName: Create PR to generation branch \ No newline at end of file diff --git a/tools/Github/CreatePR.ps1 b/tools/Github/CreatePR.ps1 new file mode 100644 index 000000000000..5214a699d282 --- /dev/null +++ b/tools/Github/CreatePR.ps1 @@ -0,0 +1,67 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.SYNOPSIS + Create PR to azure-powershell repo + +#> +param( + [Parameter(Mandatory = $true)] + [string]$BotAccessToken, + + [Parameter(Mandatory = $true)] + [string]$Title, + + [Parameter(Mandatory = $true)] + [string]$HeadBranch, + + [Parameter(Mandatory = $true)] + [string]$BaseBranch, + + [Parameter(Mandatory = $false)] + [string]$Description +) + +$Headers = @{"Accept" = "application/vnd.github+json"; "Authorization" = "Bearer $BotAccessToken"} +$PrBody = @" + + +## Description +$Description + + + +## Checklist + +- [x] Check this box to confirm: **I have read the [_Submitting Changes_](../blob/main/CONTRIBUTING.md#submitting-changes) section of [`CONTRIBUTING.md`](../blob/main/CONTRIBUTING.md) and reviewed the following information:** + +* **SHOULD** select appropriate branch. Cmdlets from Autorest.PowerShell should go to [`generation`](https://github.com/Azure/azure-powershell/tree/generation) branch. +* **SHOULD** make the title of PR clear and informative, and in the present imperative tense. +* **SHOULD** update `ChangeLog.md` file(s) appropriately + * For any service, the `ChangeLog.md` file can be found at `src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md` + * A snippet outlining the change(s) made in the PR should be written under the `## Upcoming Release` header in the past tense. Add changelog in description section if PR goes into [`generation`](https://github.com/Azure/azure-powershell/tree/generation) branch. + * Should **not** change `ChangeLog.md` if no new release is required, such as fixing test case only. +* **SHOULD** have approved design review for the changes in [this repository](https://github.com/Azure/azure-powershell-cmdlet-review-pr) ([_Microsoft internal only_](../blob/main/CONTRIBUTING.md#onboarding)) with following situations + * Create new module from scratch + * Create new resource types which are not easy to conform to [Azure PowerShell Design Guidelines](../blob/main/documentation/development-docs/design-guidelines) + * Create new resource type which name doesn't use module name as prefix + * Have design question before implementation +* **SHOULD** regenerate markdown help files if there is cmdlet API change. [Instruction](../blob/main/documentation/development-docs/help-generation.md#updating-all-markdown-files-in-a-module) +* **SHOULD** have proper test coverage for changes in pull request. +* **SHOULD NOT** introduce [breaking changes](../blob/main/documentation/breaking-changes/breaking-changes-definition.md) in Az minor release except preview version. +* **SHOULD NOT** adjust version of module manually in pull request +"@ +$RequestBody = @{"title" = $Title; "body" = $PrBody; "head" = $HeadBranch; "base" = $BaseBranch } +Invoke-WebRequest -Uri https://api.github.com/repos/Azure/azure-powershell/pulls -method POST -Headers $Headers -Body ($RequestBody | ConvertTo-Json) \ No newline at end of file