ci(sdd): cache and pin Spectral in contract-validate
All checks were successful
CI / Unit & Component Tests (push) Successful in 5m2s
CI / OCR Service Tests (push) Successful in 23s
CI / Backend Unit Tests (push) Successful in 4m44s
CI / fail2ban Regex (push) Successful in 47s
CI / Compose Bucket Idempotency (push) Successful in 1m8s
CI / Semgrep Security Scan (push) Successful in 22s
All checks were successful
CI / Unit & Component Tests (push) Successful in 5m2s
CI / OCR Service Tests (push) Successful in 23s
CI / Backend Unit Tests (push) Successful in 4m44s
CI / fail2ban Regex (push) Successful in 47s
CI / Compose Bucket Idempotency (push) Successful in 1m8s
CI / Semgrep Security Scan (push) Successful in 22s
Pins @stoplight/spectral-cli@6.16.0 and caches ~/.npm keyed on that version, so Spectral is fetched once and reused across runs instead of re-downloaded each time. A version bump busts the cache key deterministically. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit was merged in pull request #823.
This commit is contained in:
@@ -72,8 +72,19 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
|
|
||||||
|
# Cache the npm/npx download so Spectral isn't re-fetched every run. The key is pinned to
|
||||||
|
# the exact Spectral version below, so a version bump busts the cache deterministically.
|
||||||
|
- name: Cache Spectral (npm cache)
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: spectral-cli-6.16.0
|
||||||
|
restore-keys: spectral-cli-
|
||||||
|
|
||||||
- name: Lint changed OpenAPI contracts
|
- name: Lint changed OpenAPI contracts
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
SPECTRAL: "@stoplight/spectral-cli@6.16.0" # pinned — keep in sync with the cache key above
|
||||||
run: |
|
run: |
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
base="origin/${{ github.event.pull_request.base.ref }}"
|
base="origin/${{ github.event.pull_request.base.ref }}"
|
||||||
@@ -88,7 +99,7 @@ jobs:
|
|||||||
for f in $changed; do
|
for f in $changed; do
|
||||||
[ -f "$f" ] || continue
|
[ -f "$f" ] || continue
|
||||||
echo "── spectral lint $f"
|
echo "── spectral lint $f"
|
||||||
npx --yes @stoplight/spectral-cli@6 lint "$f" || rc=1
|
npx --yes "$SPECTRAL" lint "$f" || rc=1
|
||||||
done
|
done
|
||||||
exit $rc
|
exit $rc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user