From 3ee112827acddd7b42e5be4ab21449d7118f5cc4 Mon Sep 17 00:00:00 2001 From: adamcfraser Date: Tue, 10 Sep 2024 16:34:17 -0700 Subject: [PATCH] Update openapi actions on 3.1 --- .github/workflows/openapi-pr.yml | 44 ++++++++++++++++++++++++++++++++ .github/workflows/openapi.yml | 20 ++++++++++++--- 2 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/openapi-pr.yml diff --git a/.github/workflows/openapi-pr.yml b/.github/workflows/openapi-pr.yml new file mode 100644 index 0000000000..c43008fc73 --- /dev/null +++ b/.github/workflows/openapi-pr.yml @@ -0,0 +1,44 @@ +# Copyright 2024-Present Couchbase, Inc. +# +# Use of this software is governed by the Business Source License included in +# the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that +# file, in accordance with the Business Source License, use of this software +# will be governed by the Apache License, Version 2.0, included in the file +# licenses/APL2.txt. + +name: openapi-pr + +on: + pull_request: + # Only run when we change an API spec + paths: + - 'docs/api/**' + branches: + - 'master' + - 'main' + - 'release/*' + - 'beryllium' + +jobs: + redocly_preview_links: + runs-on: ubuntu-latest + steps: + - name: Find Comment + uses: peter-evans/find-comment@v3 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Redocly previews + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v4 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + ## Redocly previews + - [Admin API](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/couchbase/sync_gateway/${{ github.event.pull_request.head.sha }}/docs/api/admin.yaml) + - [Public API](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/couchbase/sync_gateway/${{ github.event.pull_request.head.sha }}/docs/api/public.yaml) + - [Metric API](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/couchbase/sync_gateway/${{ github.event.pull_request.head.sha }}/docs/api/metric.yaml) + - [Diagnostic API](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/couchbase/sync_gateway/${{ github.event.pull_request.head.sha }}/docs/api/diagnostic.yaml) + edit-mode: replace diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml index 0a6cd56b20..fec04e3e47 100644 --- a/.github/workflows/openapi.yml +++ b/.github/workflows/openapi.yml @@ -13,9 +13,12 @@ on: # Only run when we change an API spec paths: - 'docs/api/**' - branches: + branches: - 'master' + - 'main' - 'release/*' + - 'feature/*' + - 'beryllium' - 'CBG*' - 'ci-*' - 'api-ci-*' @@ -25,17 +28,28 @@ on: - 'docs/api/**' branches: - 'master' + - 'main' - 'release/*' + - 'beryllium' jobs: api_validation: runs-on: ubuntu-latest name: OpenAPI Validation steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r7kamura/redocly-problem-matchers@v1 - - uses: mhiew/redoc-lint-github-action@v3 + - uses: mhiew/redoc-lint-github-action@v4 with: args: '--format stylish' env: NO_COLOR: '1' + + yamllint: + name: 'yamllint' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: karancode/yamllint-github-action@master + with: + yamllint_file_or_dir: 'docs/api'