Skip to content

Fix the issue that cannot create branch #23872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 26 additions & 32 deletions .azure-pipelines/code-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,36 +75,30 @@ jobs:
}
git checkout src/${{ parameters.ServiceName }};
git checkout -b codegen/${{ parameters.ServiceName }} origin/${{ parameters.TargetBranch }};
- task: [email protected]
- pwsh: |
#Uninstall-Module -Name PackageManagement -AllVersions
Install-Module -Name PowerShellGet -RequiredVersion 2.2.3 -Force;
Install-Module -Name platyPS -RequiredVersion 0.14.2 -Force;
Install-Module -Name Az.Accounts -Force;
Import-Module .\tools\Gen2Master\MoveFromGeneration2Master.ps1;
Move-Generation2Master -SourcePath .\artifacts\src\${{ parameters.ServiceName }} -DestPath .\src\${{ parameters.ServiceName }};
git config user.email "[email protected]";
git config user.name "azure-powershell-bot";
git add ./src;
git add tools/CreateMappings_rules.json;
git commit -m "Move ${{ parameters.ServiceName }} to ${{ parameters.TargetBranch }}";
git remote set-url origin https://azure-powershell-bot:$(GithubToken)@github.com/Azure/azure-powershell.git;
git push origin codegen/${{ parameters.ServiceName }} --force;
displayName: Create codegen/${{ parameters.ServiceName }} branch
inputs:
targetType: inline
script: >-
#Uninstall-Module -Name PackageManagement -AllVersions
Install-Module -Name PowerShellGet -RequiredVersion 2.2.3 -Force;
Install-Module -Name platyPS -RequiredVersion 0.14.2 -Force;
Install-Module -Name Az.Accounts -Force;
Import-Module .\tools\Gen2Master\MoveFromGeneration2Master.ps1;
Move-Generation2Master -SourcePath .\artifacts\src\${{ parameters.ServiceName }} -DestPath .\src\${{ parameters.ServiceName }};
git config user.email "[email protected]";
git config user.name "azure-powershell-bot";
git add ./src;
git add tools/CreateMappings_rules.json;
git commit -m "Move ${{ parameters.ServiceName }} to ${{ parameters.TargetBranch }}";
git remote set-url origin https://azure-powershell-bot:$(GithubToken)@github.com/Azure/azure-powershell.git;
git push origin codegen/${{ parameters.ServiceName }} --force;
- task: PowerShell@2
displayName: Create PR to main branch
inputs:
targetType: inline
script: >-
$SourceBranch = "$(Build.SourceBranch)"
$SourceBranch = $SourceBranch.Replace("refs/heads/", "")
$Title = "Migrate ${{ parameters.ServiceName }} from $SourceBranch to ${{ parameters.TargetBranch }}"
$HeadBranch = "codegen/${{ parameters.ServiceName }}"
$BaseBranch = "${{ parameters.TargetBranch }}"
$Description = "Migrate ${{ parameters.ServiceName }} from $SourceBranch to ${{ parameters.TargetBranch }}
The last commit of src/${{ parameters.ServiceName }} in $SourceBranch is:
$(git log -1 origin/$SourceBranch -- ./src/${{ parameters.ServiceName }})
"
./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(GithubToken) -Description $Description
- pwsh: |
$SourceBranch = "$(Build.SourceBranch)"
$SourceBranch = $SourceBranch.Replace("refs/heads/", "")
$Title = "Migrate ${{ parameters.ServiceName }} from $SourceBranch to ${{ parameters.TargetBranch }}"
$HeadBranch = "codegen/${{ parameters.ServiceName }}"
$BaseBranch = "${{ parameters.TargetBranch }}"
$Description = "Migrate ${{ parameters.ServiceName }} from $SourceBranch to ${{ parameters.TargetBranch }}
The last commit of src/${{ parameters.ServiceName }} in $SourceBranch is:
$(git log -1 origin/$SourceBranch -- ./src/${{ parameters.ServiceName }})
"
./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(GithubToken) -Description $Description
displayName: Create PR to main branch