diff --git a/.azure-pipelines/sync-aliases.yml b/.azure-pipelines/sync-aliases.yml index 847b7cebdbe2..1a1e4d226524 100644 --- a/.azure-pipelines/sync-aliases.yml +++ b/.azure-pipelines/sync-aliases.yml @@ -14,6 +14,17 @@ jobs: ./tools/Github/ParseWiki2Json.ps1 -ADOToken $(ADOToken) displayName: Update fabricbot.json file locally + - pwsh: | + $gitStatus = git status -s + if (-not $gitStatus) { + Write-Host "The wiki has no changes ." + Write-Host "##vso[task.setvariable variable=ChangesDetected]false" + } else { + Write-Host "There are changes in the repository." + Write-Host "##vso[task.setvariable variable=ChangesDetected]true" + } + displayName: Check if Wiki table has any changes + - pwsh: | git config --global user.email "65331932+azure-powershell-bot@users.noreply.github.com" git config --global user.name "azure-powershell-bot" @@ -25,17 +36,13 @@ jobs: git remote set-url origin https://azure-powershell-bot:$(BotAccessToken)@github.com/Azure/azure-powershell.git; git push origin internal/sync-fabricbot-json --force displayName: Git commit and push + condition: and(succeeded(), eq(variables['ChangesDetected'], 'true')) - pwsh: | - $diff = git diff main..internal/sync-fabricbot-json - if ($diff.Length -eq 0) { - Write-Host "No differences between main and internal/sync-fabricbot-json. Skipping PR creation." - } else { - $Title = "Sync fabricbot.json According To ADO Wiki Page" - $HeadBranch = "internal/sync-fabricbot-json" - $BaseBranch = "main" - $Description = "This PR sync taskType: scheduledAndTrigger part of fabricbot.json from table of Service-Team-Label-and-Contact-List in ADO wiki page" - ./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(BotAccessToken) -Description $Description - } + $Title = "Sync fabricbot.json According To ADO Wiki Page" + $HeadBranch = "internal/sync-fabricbot-json" + $BaseBranch = "main" + $Description = "This PR sync taskType: scheduledAndTrigger part of fabricbot.json from table of Service-Team-Label-and-Contact-List in ADO wiki page" + ./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(BotAccessToken) -Description $Description displayName: Create PR to main branch - + condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))