Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"build.proj"
],
"UnSyncPath": [
"tools/BranchSync"
".azure-pipelines/SyncFromMainBranchConfig.json"
]
}
2 changes: 1 addition & 1 deletion .azure-pipelines/sync-tools-folder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ jobs:
inputs:
targetType: inline
script: >-
./tools/BranchSync/BranchSync.ps1 -BranchName $(BranchName) -GithubToken $env:GITHUB_TOKEN
./tools/SyncFromMainBranch.ps1 -BranchName $(BranchName) -GithubToken $env:GITHUB_TOKEN
pwsh: true
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ param(
[string]$GithubToken
)

$Config = Get-Content (Join-Path $PSScriptRoot "config.json") | ConvertFrom-Json
$Config = Get-Content (Join-Path $PSScriptRoot "../.azure-pipelines/SyncFromMainBranchConfig.json") | ConvertFrom-Json
$TmpFolder = New-Item -ItemType Directory -Path tmp

foreach ($SyncPath in $Config.SyncPath)
{
Write-Host "Back up $SyncPath from main branch."
Copy-Item -Path $SyncPath -Destination "$TmpFolder/$SyncPath" -Recurse
Copy-Item -Path $SyncPath -Destination "$TmpFolder/$SyncPath" -Recurse -Force
}

git config --global user.email "azurepowershell@ms.com"
Expand All @@ -30,10 +30,10 @@ foreach ($UnSyncPath in $Config.UnSyncPath)
foreach ($SyncPath in $Config.SyncPath)
{
Remove-Item -Path $SyncPath -Recurse
Copy-Item -Path "$TmpFolder/$SyncPath" -Destination $SyncPath -Recurse
Copy-Item -Path "$TmpFolder/$SyncPath" -Destination $SyncPath -Recurse -Force
git add $SyncPath
}

git commit -m "Sync tools folder from main branch to $BranchName branch"
git remote set-url origin "https://$GithubToken@github.com/Azure/azure-powershell.git"
git push origin "syncToolsFolder-$BranchName" --force
git push origin "syncToolsFolder-$BranchName" --force