Skip to content

Commit efe36c0

Browse files
committed
ci: name branch using endpointversion, add clarity for host output
1 parent 4666254 commit efe36c0

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

scripts/git-push-cleanmetadata.ps1

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,71 @@ if ($env:PublishChanges -eq $False)
1515
return;
1616
}
1717

18-
Write-Host "`ngit status:"
18+
Write-Host "`n1. git status:"
1919
git status | Write-Host
2020

21-
Write-Host "`nStash the update metadata files.....`nRunning: git stash"
21+
Write-Host "`n2. Stash the update metadata files.....`n3. Running: git stash"
2222
git stash | Write-Host
2323

24-
Write-Host "`nFetching latest master branch to ensure we are up to date..."
24+
Write-Host "`n4. Fetching latest master branch to ensure we are up to date..."
2525
git fetch origin master | Write-Host
2626
# checkout master to move from detached HEAD mode
2727
git switch master | Write-Host
2828

29-
Write-Host "`ngit status:"
29+
30+
31+
Write-Host "`n5. git status:"
3032
git status | Write-Host
3133

32-
Write-Host "`nApply stashed metadata files...`nRunning: git stash pop"
34+
Write-Host "`n6. Apply stashed metadata files...`n7. Running: git stash pop"
3335
git stash pop | Write-Host
3436

35-
Write-Host "`ngit status:"
37+
Write-Host "`n8. git status:"
3638
git status | Write-Host
3739

40+
$branch = "$env:EndpointVersion/$env:BUILD_BUILDID/updateOpenAPI"
41+
3842
if ($env:CreateOpenAPIPR -eq $True)
3943
{
40-
Write-Host "`nCreate branch: $env:BUILD_BUILDID/updateOpenAPI"
41-
git checkout -B $env:BUILD_BUILDID/updateOpenAPI | Write-Host
44+
Write-Host "`n9. Create branch: $branch"
45+
git checkout -B $branch | Write-Host
4246
}
4347

44-
Write-Host "`nStaging clean $env:EndpointVersion metadata files.....`nRunning: git add ."
48+
Write-Host "`n10. Staging clean $env:EndpointVersion metadata files.....`n11. Running: git add ."
4549
git add . | Write-Host
4650

47-
Write-Host "`ngit status:"
51+
Write-Host "`n12. git status:"
4852
git status | Write-Host
4953

50-
Write-Host "`nAttempting to commit clean $env:EndpointVersion metadata files....."
54+
Write-Host "`n13. Attempting to commit clean $env:EndpointVersion metadata files....."
5155

5256
if ($env:BUILD_REASON -eq 'Manual') # Skip CI if manually running this pipeline.
5357
{
54-
git commit -m "Update clean metadata file with $env:BUILD_BUILDID [skip ci]" | Write-Host
58+
git commit -m "Update clean $env:EndpointVersion metadata file with $env:BUILD_BUILDID [skip ci]" | Write-Host
5559
}
5660
else
5761
{
58-
git commit -m "Update clean metadata file with $env:BUILD_BUILDID" | Write-Host
62+
git commit -m "Update clean $env:EndpointVersion metadata file with $env:BUILD_BUILDID" | Write-Host
5963
}
6064

61-
Write-Host "`ngit status:"
65+
Write-Host "`n14. git status:"
6266
git status | Write-Host
6367

6468
if ($env:CreateOpenAPIPR -eq $True)
6569
{
66-
Write-Host "`nPushing branch for PR creation"
70+
Write-Host "`n15a. Pushing branch for PR creation"
6771

68-
Write-Host "`ngit push --set-upstream origin $env:BUILD_BUILDID/updateOpenAPI:"
69-
git push --set-upstream origin $env:BUILD_BUILDID/updateOpenAPI | Write-Host
72+
Write-Host "`n15b. Running: git push --set-upstream origin $branch"
73+
git push --set-upstream origin $branch | Write-Host
7074
}
7175
else # original behavior: push to master
7276
{
73-
Write-Host "`nRunning: git pull origin master --rebase..."
77+
Write-Host "`n15c. Running: git pull origin master --rebase..."
7478
# sync branch before pushing
7579
# this is especially important while running v1 and beta in parallel
7680
# and one process goes out of sync because of the other's check-in
7781
git pull origin master --rebase | Write-Host
7882

79-
Write-Host "`nRunning: git push --set-upstream origin master ..."
83+
Write-Host "`n15d. Running: git push --set-upstream origin master ..."
8084
git push --set-upstream origin master | Write-Host
8185
}

0 commit comments

Comments
 (0)