Update permissions reference file #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update permissions reference file | |
on: | |
schedule: | |
- cron: 0 6 * * 1 # Runs every Monday at 6 AM UTC | |
workflow_dispatch: # Allows manual triggering of the workflow | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update-permissions-reference: | |
name: Update permissions reference | |
runs-on: windows-latest | |
steps: | |
- name: Set up Git to handle long paths | |
run: git config --system core.longpaths true | |
- name: Checkout microsoft-graph-docs | |
uses: actions/checkout@v4.1.3 | |
with: | |
path: docs | |
- name: Run PowerShell script | |
shell: pwsh | |
run: | | |
$ClientId = "${{ secrets.GRAPH_CLIENT_ID }}" | |
$TenantId = "${{ secrets.GRAPH_TENANT_ID }}" | |
$ClientSecret = "${{ secrets.GRAPH_CLIENT_SECRET }}" | |
./docs/update-permissions-reference.ps1 -ClientId $ClientId -TenantId $TenantId -ClientSecret $ClientSecret | |
- name: Get token | |
id: get_token | |
uses: microsoftgraph/get-app-token@v1.0.4 | |
with: | |
application-id: ${{ secrets.APPLICATION_ID }} | |
application-private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
- name: Commit updates and open a pull request | |
working-directory: ./docs | |
shell: pwsh | |
env: | |
GH_TOKEN: ${{ steps.get_token.outputs.app-token }} | |
run: | | |
$status = git status --porcelain | |
if ($status -eq $null) { | |
Write-Host "No changes to commit." -ForegroundColor Green | |
} else { | |
$timestamp = Get-Date -Format FileDateTimeUniversal | |
git config user.email "GraphTooling@service.microsoft.com" | |
git config user.name "Microsoft Graph DevX Tooling" | |
git checkout -b permissions-reference/$timestamp | |
git add . | |
git commit -m "Update permissions reference" | |
git push --set-upstream origin permissions-reference/$timestamp | |
gh pr create --base main --title "Automated permissons reference update" --body "Scheduled permissions reference update" --reviewer "FaithOmbongi","msewaweru" --label "ready for content review" | |
} |