2d8ad295d4
Validate Flux manifests / kustomize-build (pull_request) Failing after 20s
Add vin-decoder as 4th entry to the APIS array in scripts/publish-openapi.js and add RAPIDAPI_VIN_API_ID / RAPIDAPI_VIN_VERSION_ID secrets to the publish-openapi.yaml CI workflow env block. Closes leeworks-agents/api-company#138
62 lines
2.1 KiB
YAML
62 lines
2.1 KiB
YAML
# Validate and publish OpenAPI specs to RapidAPI when apis/*/openapi.yaml changes on main.
|
|
# Requires secrets (configured once RapidAPI listings are live):
|
|
# RAPIDAPI_PLATFORM_KEY, RAPIDAPI_ZIP_API_ID, RAPIDAPI_ZIP_VERSION_ID,
|
|
# RAPIDAPI_HOLIDAYS_API_ID, RAPIDAPI_HOLIDAYS_VERSION_ID,
|
|
# RAPIDAPI_AQI_API_ID, RAPIDAPI_AQI_VERSION_ID,
|
|
# RAPIDAPI_VIN_API_ID, RAPIDAPI_VIN_VERSION_ID
|
|
#
|
|
# If RAPIDAPI_PLATFORM_KEY is not set the publish step exits 0 with a skip message.
|
|
|
|
name: Validate and Publish OpenAPI Specs
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'apis/*/openapi.yaml'
|
|
|
|
jobs:
|
|
publish:
|
|
name: Lint and publish specs
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout (with history for diff)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Set up Node.js 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install Redocly CLI
|
|
run: npm install -g @redocly/cli@latest
|
|
|
|
- name: Lint OpenAPI specs
|
|
run: |
|
|
echo "Linting all OpenAPI specs..."
|
|
npx @redocly/cli lint apis/*/openapi.yaml
|
|
|
|
- name: Detect changed specs
|
|
id: changed
|
|
run: |
|
|
changed=$(git diff --name-only HEAD~1 HEAD | grep 'openapi\.yaml' || true)
|
|
echo "Changed specs: ${changed:-none}"
|
|
echo "files=${changed}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Publish specs to RapidAPI
|
|
env:
|
|
RAPIDAPI_KEY: ${{ secrets.RAPIDAPI_PLATFORM_KEY }}
|
|
RAPIDAPI_ZIP_API_ID: ${{ secrets.RAPIDAPI_ZIP_API_ID }}
|
|
RAPIDAPI_ZIP_VERSION_ID: ${{ secrets.RAPIDAPI_ZIP_VERSION_ID }}
|
|
RAPIDAPI_HOLIDAYS_API_ID: ${{ secrets.RAPIDAPI_HOLIDAYS_API_ID }}
|
|
RAPIDAPI_HOLIDAYS_VERSION_ID: ${{ secrets.RAPIDAPI_HOLIDAYS_VERSION_ID }}
|
|
RAPIDAPI_AQI_API_ID: ${{ secrets.RAPIDAPI_AQI_API_ID }}
|
|
RAPIDAPI_AQI_VERSION_ID: ${{ secrets.RAPIDAPI_AQI_VERSION_ID }}
|
|
RAPIDAPI_VIN_API_ID: ${{ secrets.RAPIDAPI_VIN_API_ID }}
|
|
RAPIDAPI_VIN_VERSION_ID: ${{ secrets.RAPIDAPI_VIN_VERSION_ID }}
|
|
run: node scripts/publish-openapi.js
|