From 80dccba26c67edd1fb363be85eb1ca98a2468a7c Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki Date: Sat, 9 May 2026 22:10:54 +0000 Subject: [PATCH] Add CI workflow for OpenAPI linting and bundle integrity The bundle integrity check guards against contributors editing source files without re-running yarn openapi:bundle, which would otherwise quietly desynchronize the bundled artifact from its source. --- .github/workflows/openapi.yml | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/openapi.yml diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml new file mode 100644 index 00000000000..af787665f74 --- /dev/null +++ b/.github/workflows/openapi.yml @@ -0,0 +1,45 @@ +name: OpenAPI +on: + merge_group: + push: + branches: + - 'main' + - 'stable-*' + paths: + - 'openapi/**' + - 'redocly.yaml' + - 'package.json' + - 'yarn.lock' + - '.nvmrc' + - '.github/workflows/openapi.yml' + + pull_request: + paths: + - 'openapi/**' + - 'redocly.yaml' + - 'package.json' + - 'yarn.lock' + - '.nvmrc' + - '.github/workflows/openapi.yml' + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + + - name: Set up Javascript environment + uses: ./.github/actions/setup-javascript + + - name: Lint OpenAPI specification + run: yarn openapi:lint + + - name: Verify bundled OpenAPI artifact is up to date + run: | + yarn openapi:bundle + if ! git diff --exit-code openapi/openapi.json; then + echo "::error::openapi/openapi.json is out of date. Run 'yarn openapi:bundle' and commit the result." >&2 + exit 1 + fi