Skip to content

Commit 1a4a204

Browse files
greathongtuHongtu Zhang (FA Talent)
andauthored
Pipeline for fabricbot aliases (#20931)
* add pipeline yml for syncing fabricbot.json aliases * change git user name and email in script * change inline script to GetUncyclo2Json.ps1 file * remove unnecessary code * change wrong dir * change to my personal repo for test * change the usage of token * change CreatePR.ps1 for test * correct ParseUncyclo2Json.ps1 * remove unnecessary output * remove quote * finish test, change back to Azure repo * change branch name * change some names * remove the use of magic number * change commit message * remove redundant git pull * change the way of getting wiki content * change space to - * add md * set current dir * use space * use - * still use ADOToken * use a better wiki url * test purpose * test2 * test oauth * test3 * finish test * test again * test * finish test * test cron * test double pr * solve double pr * test * test * test * finish test * test * finish test * test restapi * te * finish test * test * finish test * filter pr * test * test * test * test * finish test * Solve pipeline error when no changes * add newline at end of file * change to pwsh * test diff * test * test * test * test * test * test * test * test * test * test * test * test * testt * testt * testt * testt * Update sync-aliases.yml for Azure Pipelines * testt * testt * test yml condition synthx * add succeed * add trim * add null check * add newline * remove checkout * use right url * remove diff --------- Co-authored-by: Hongtu Zhang (FA Talent) <[email protected]>
1 parent 70a01e4 commit 1a4a204

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.azure-pipelines/sync-aliases.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ jobs:
1414
./tools/Github/ParseUncyclo2Json.ps1 -ADOToken $(ADOToken)
1515
displayName: Update fabricbot.json file locally
1616
17+
- pwsh: |
18+
$gitStatus = git status -s
19+
if (-not $gitStatus) {
20+
Write-Host "The wiki has no changes ."
21+
Write-Host "##vso[task.setvariable variable=ChangesDetected]false"
22+
} else {
23+
Write-Host "There are changes in the repository."
24+
Write-Host "##vso[task.setvariable variable=ChangesDetected]true"
25+
}
26+
displayName: Check if Uncyclo table has any changes
27+
1728
- pwsh: |
1829
git config --global user.email "[email protected]"
1930
git config --global user.name "azure-powershell-bot"
@@ -25,17 +36,13 @@ jobs:
2536
git remote set-url origin https://azure-powershell-bot:$(BotAccessToken)@github.com/Azure/azure-powershell.git;
2637
git push origin internal/sync-fabricbot-json --force
2738
displayName: Git commit and push
39+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))
2840
2941
- pwsh: |
30-
$diff = git diff main..internal/sync-fabricbot-json
31-
if ($diff.Length -eq 0) {
32-
Write-Host "No differences between main and internal/sync-fabricbot-json. Skipping PR creation."
33-
} else {
34-
$Title = "Sync fabricbot.json According To ADO Uncyclo Page"
35-
$HeadBranch = "internal/sync-fabricbot-json"
36-
$BaseBranch = "main"
37-
$Description = "This PR sync taskType: scheduledAndTrigger part of fabricbot.json from table of Service-Team-Label-and-Contact-List in ADO wiki page"
38-
./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(BotAccessToken) -Description $Description
39-
}
42+
$Title = "Sync fabricbot.json According To ADO Uncyclo Page"
43+
$HeadBranch = "internal/sync-fabricbot-json"
44+
$BaseBranch = "main"
45+
$Description = "This PR sync taskType: scheduledAndTrigger part of fabricbot.json from table of Service-Team-Label-and-Contact-List in ADO wiki page"
46+
./tools/Github/CreatePR.ps1 -Title $Title -HeadBranch $HeadBranch -BaseBranch $BaseBranch -BotAccessToken $(BotAccessToken) -Description $Description
4047
displayName: Create PR to main branch
41-
48+
condition: and(succeeded(), eq(variables['ChangesDetected'], 'true'))

0 commit comments

Comments
 (0)