Skip to content

Commit

Permalink
Update docs permissions tables generation pipeline (#1896)
Browse files Browse the repository at this point in the history
* Add custom commit message for generated permissions tables for docs

* Update docs permissions tables generation pipeline to run every weekday at 11:00AM UTC
  • Loading branch information
millicentachieng authored Jan 12, 2024
1 parent d43e706 commit c03efd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
12 changes: 9 additions & 3 deletions pipelines/docs-permissions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
trigger: none
pr: none
schedules:
- cron: "0 9 * * 2"
displayName: Weekly Tuesday graph docs permissions updates
- cron: "0 11 * * 1-5"
displayName: Every weekday MS Graph docs permissions tables updates
branches:
include:
- master
Expand Down Expand Up @@ -61,10 +61,16 @@ steps:

- pwsh: |
# override branch prefix incase the run is manually triggered
$branchPrefix = if ($env:BUILD_REASON -eq 'Manual') { "preview-permissions-table-update" } else { "permissions-table-update" }
$branchPrefix = if ($env:BUILD_REASON -eq 'Manual') { "preview-permissions-tables-update" } else { "permissions-tables-update" }
Write-Host "##vso[task.setvariable variable=branchPrefix]$branchPrefix"
Write-Host "Branch prefix is $branchPrefix"
displayName: 'Evaluate branch prefix to use'

- pwsh: |
# set commit message to use when there are changes to push
$commitMessage = "Update generated permissions tables with build $env:BUILD_BUILDID"
Write-Host "##vso[task.setvariable variable=commitMessage]$commitMessage"
displayName: 'Set commit message to use'

- template: templates/git-config.yml

Expand Down
12 changes: 10 additions & 2 deletions pipelines/templates/commit-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ steps:
Write-Host "No changes to commit." -ForegroundColor Green
} else {
git add . | Write-Host
# Set commit message
$commitMessage = $env:COMMITMESSAGE
if ([string]::IsNullOrWhiteSpace($commitMessage))
{
$commitMessage = "Update generated files with build $env:BUILD_BUILDID"
}
if ($env:BUILD_REASON -eq 'Manual') # Skip CI if manually running this pipeline.
{
git commit -m "Update generated files with build $env:BUILD_BUILDID [skip ci]" | Write-Host
git commit -m "$commitMessage [skip ci]" | Write-Host
}
else
{
git commit -m "Update generated files with build $env:BUILD_BUILDID" | Write-Host
git commit -m $commitMessage | Write-Host
}
Write-Host "Added and commited generated files." -ForegroundColor Green
Write-Host "##vso[task.setvariable variable=shouldPushBranch]true"
Expand Down

0 comments on commit c03efd8

Please sign in to comment.