-
Notifications
You must be signed in to change notification settings - Fork 326
98 lines (95 loc) · 5.07 KB
/
cloud-support.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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"
}