Update cloud support status #35
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 cloud support status | |
on: | |
schedule: | |
- cron: 0 11 * * 1 | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update-cloud-support: | |
name: Update cloud support | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout docs repo | |
uses: actions/[email protected] | |
with: | |
path: docs | |
- name: Checkout metadata repo | |
uses: actions/[email protected] | |
with: | |
repository: microsoftgraph/msgraph-metadata | |
path: metadata | |
- name: Checkout tool repo | |
uses: actions/[email protected] | |
with: | |
repository: microsoftgraph/msgraph-cloud-support | |
path: tool | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.x | |
- name: Build cloud support tool | |
working-directory: ./tool | |
run: dotnet build --configuration Release | |
- name: Install hidi | |
run: dotnet tool install microsoft.openapi.hidi -g | |
- name: Create metadata output directory | |
run: | | |
mkdir openapi | |
cd openapi | |
mkdir v1.0 | |
mkdir beta | |
- name: Apply XSLT to CSDL files | |
working-directory: ./metadata | |
shell: pwsh | |
run: | | |
./transforms/csdl/transform.ps1 -xslPath preprocess_csdl.xsl -inputPath ../../schemas/v1.0-Prod.csdl -outputPath ../../transformed_v1.0-Prod.csdl -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion v1.0 | |
./transforms/csdl/transform.ps1 -xslPath preprocess_csdl.xsl -inputPath ../../schemas/v1.0-Fairfax.csdl -outputPath ../../transformed_v1.0-Fairfax.csdl -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion v1.0 | |
./transforms/csdl/transform.ps1 -xslPath preprocess_csdl.xsl -inputPath ../../schemas/v1.0-Mooncake.csdl -outputPath ../../transformed_v1.0-Mooncake.csdl -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion v1.0 | |
./transforms/csdl/transform.ps1 -xslPath preprocess_csdl.xsl -inputPath ../../schemas/beta-Prod.csdl -outputPath ../../transformed_beta-Prod.csdl -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion v1.0 | |
./transforms/csdl/transform.ps1 -xslPath preprocess_csdl.xsl -inputPath ../../schemas/beta-Fairfax.csdl -outputPath ../../transformed_beta-Fairfax.csdl -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion v1.0 | |
./transforms/csdl/transform.ps1 -xslPath preprocess_csdl.xsl -inputPath ../../schemas/beta-Mooncake.csdl -outputPath ../../transformed_beta-Mooncake.csdl -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion v1.0 | |
- name: Transform CSDL with hidi | |
working-directory: ./metadata | |
shell: pwsh | |
env: | |
SETTINGS: ./conversion-settings/openapi.json | |
run: | | |
hidi transform --cs transformed_v1.0-Prod.csdl -o ../openapi/v1.0/Prod.yml --co -f Yaml --sp $Env:SETTINGS | |
hidi transform --cs transformed_v1.0-Fairfax.csdl -o ../openapi/v1.0/Fairfax.yml --co -f Yaml --sp $Env:SETTINGS | |
hidi transform --cs transformed_v1.0-Mooncake.csdl -o ../openapi/v1.0/Mooncake.yml --co -f Yaml --sp $Env:SETTINGS | |
hidi transform --cs transformed_beta-Prod.csdl -o ../openapi/beta/Prod.yml --co -f Yaml --sp $Env:SETTINGS | |
hidi transform --cs transformed_beta-Fairfax.csdl -o ../openapi/beta/Fairfax.yml --co -f Yaml --sp $Env:SETTINGS | |
hidi transform --cs transformed_beta-Mooncake.csdl -o ../openapi/beta/Mooncake.yml --co -f Yaml --sp $Env:SETTINGS | |
- name: Run cloud support tool | |
env: | |
TOOL: ./tool/src/bin/Release/net8.0/CheckCloudSupport | |
run: | | |
$TOOL --open-api ./openapi/v1.0 --api-docs ./docs/api-reference/v1.0/api --overrides ./docs/api-reference/cloud.api.overrides.json --excludes ./docs/api-reference/cloud.exclusions.json --remove-old-includes | |
$TOOL --open-api ./openapi/beta --api-docs ./docs/api-reference/beta/api --overrides ./docs/api-reference/cloud.api.overrides.json --excludes ./docs/api-reference/cloud.exclusions.json --remove-old-includes | |
- name: Get token | |
id: get_token | |
uses: microsoftgraph/[email protected] | |
with: | |
application-id: ${{ secrets.APPLICATION_ID }} | |
application-private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
- name: Commit updates and open 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 "[email protected]" | |
git config user.name "Microsoft Graph DevX Tooling" | |
git checkout -b cloud-support/$timestamp | |
git add . | |
git commit -m "Update cloud support status" | |
git push --set-upstream origin cloud-support/$timestamp | |
gh pr create --base main --title "Update cloud support status" --body "Ran cloud support tool" --label "ready to merge" | |
} |