50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
name: api-governance
|
|
on:
|
|
push:
|
|
paths:
|
|
- "src/Api/**"
|
|
- ".spectral.yaml"
|
|
- "package.json"
|
|
pull_request:
|
|
paths:
|
|
- "src/Api/**"
|
|
- ".spectral.yaml"
|
|
- "package.json"
|
|
|
|
jobs:
|
|
spectral-lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "18"
|
|
- name: Install npm deps
|
|
run: npm install --ignore-scripts --no-progress
|
|
- name: Compose aggregate OpenAPI
|
|
run: npm run api:compose
|
|
- name: Validate examples coverage
|
|
run: npm run api:examples
|
|
- name: Compatibility diff (previous commit)
|
|
run: |
|
|
set -e
|
|
if git show HEAD~1:src/Api/StellaOps.Api.OpenApi/stella.yaml > /tmp/stella-prev.yaml 2>/dev/null; then
|
|
node scripts/api-compat-diff.mjs /tmp/stella-prev.yaml src/Api/StellaOps.Api.OpenApi/stella.yaml --output text --fail-on-breaking
|
|
else
|
|
echo "[api:compat] previous stella.yaml not found; skipping"
|
|
fi
|
|
- name: Compatibility diff (baseline)
|
|
run: |
|
|
set -e
|
|
if [ -f src/Api/StellaOps.Api.OpenApi/baselines/stella-baseline.yaml ]; then
|
|
node scripts/api-compat-diff.mjs src/Api/StellaOps.Api.OpenApi/baselines/stella-baseline.yaml src/Api/StellaOps.Api.OpenApi/stella.yaml --output text
|
|
else
|
|
echo "[api:compat] baseline file missing; skipping"
|
|
fi
|
|
- name: Generate changelog
|
|
run: npm run api:changelog
|
|
- name: Spectral lint (fail on warning+)
|
|
run: npm run api:lint
|