Skip to content

Commit 73995fd

Browse files
committed
update Lint OpenApi doc action
Related to: aliencube#221
1 parent 39ce1b7 commit 73995fd

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

.github/workflows/azure-dev-build-only.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
permissions:
1515
id-token: write
16-
contents: write
16+
contents: read
1717
issues: write
1818
pull-requests: write
1919

@@ -75,10 +75,15 @@ jobs:
7575
- name: Lint OpenAPI doc
7676
shell: pwsh
7777
run: |
78-
$LINT_RESULT = spectral lint -f json -F warn -D openapi.json
79-
80-
if( $LINT_RESULT.Count -ge 1) {
81-
$LINT_RESULT
78+
$LINT_RESULT = spectral lint -f json -F warn -D -q openapi.json | ConvertFrom-Json
79+
80+
if( $LINT_RESULT.Count -gt 0) {
81+
$LINT_RESULT | ForEach-Object {
82+
echo ("code: " + $_.code)
83+
echo ("message: " + $_.message)
84+
echo ("path: " + $_.path)
85+
echo "`n"
86+
}
8287
exit 1
8388
}
8489

.github/workflows/azure-dev.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
permissions:
1212
id-token: write
13-
contents: write
13+
contents: read
1414

1515
jobs:
1616
build-test-deploy:
@@ -82,19 +82,22 @@ jobs:
8282
8383
Start-Sleep -Seconds 30
8484
85-
Remove-Item -Path "openapi.json" -Force
86-
8785
Invoke-WebRequest -Uri "https://localhost:7001/swagger/$API_VERSION/swagger.json" -OutFile "openapi.json"
8886
8987
$PROCESS.Kill()
9088
9189
- name: Lint OpenAPI doc
9290
shell: pwsh
9391
run: |
94-
$LINT_RESULT = spectral lint -f json -F warn -D openapi.json
95-
96-
if( $LINT_RESULT.Count -ge 1) {
97-
$LINT_RESULT
92+
$LINT_RESULT = spectral lint -f json -F warn -D -q openapi.json | ConvertFrom-Json
93+
94+
if( $LINT_RESULT.Count -gt 0) {
95+
$LINT_RESULT | ForEach-Object {
96+
echo ("code: " + $_.code)
97+
echo ("message: " + $_.message)
98+
echo ("path: " + $_.path)
99+
echo "`n"
100+
}
98101
exit 1
99102
}
100103

0 commit comments

Comments
 (0)