Skip to content

Commit 79d4ad9

Browse files
authored
Add sync and unsync config for sync task (Azure#16101)
* Add sync path and unsync path * Add sync path and unsync path * Add sync path and unsync path Co-authored-by: wyunchi-ms <[email protected]>
1 parent acfd5a8 commit 79d4ad9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tools/BranchSync/config.json renamed to .azure-pipelines/SyncFromMainBranchConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"build.proj"
77
],
88
"UnSyncPath": [
9-
"tools/BranchSync"
9+
".azure-pipelines/SyncFromMainBranchConfig.json"
1010
]
1111
}

.azure-pipelines/sync-tools-folder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ jobs:
3535
inputs:
3636
targetType: inline
3737
script: >-
38-
./tools/BranchSync/BranchSync.ps1 -BranchName $(BranchName) -GithubToken $env:GITHUB_TOKEN
38+
./tools/SyncFromMainBranch.ps1 -BranchName $(BranchName) -GithubToken $env:GITHUB_TOKEN
3939
pwsh: true

tools/BranchSync/BranchSync.ps1 renamed to tools/SyncFromMainBranch.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ param(
66
[string]$GithubToken
77
)
88

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

1212
foreach ($SyncPath in $Config.SyncPath)
1313
{
1414
Write-Host "Back up $SyncPath from main branch."
15-
Copy-Item -Path $SyncPath -Destination "$TmpFolder/$SyncPath" -Recurse
15+
Copy-Item -Path $SyncPath -Destination "$TmpFolder/$SyncPath" -Recurse -Force
1616
}
1717

1818
git config --global user.email "[email protected]"
@@ -30,10 +30,10 @@ foreach ($UnSyncPath in $Config.UnSyncPath)
3030
foreach ($SyncPath in $Config.SyncPath)
3131
{
3232
Remove-Item -Path $SyncPath -Recurse
33-
Copy-Item -Path "$TmpFolder/$SyncPath" -Destination $SyncPath -Recurse
33+
Copy-Item -Path "$TmpFolder/$SyncPath" -Destination $SyncPath -Recurse -Force
3434
git add $SyncPath
3535
}
3636

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

0 commit comments

Comments
 (0)