From 5dc5cc9b62da154c5ed52b180e287c074e00e2bd Mon Sep 17 00:00:00 2001 From: Giovanni Grano Date: Thu, 17 Oct 2024 19:17:38 -0400 Subject: [PATCH 1/2] Add workflow to update the openapi spec in the dedicated repo --- .github/workflows/update_openapi_spec.yml | 23 +++++++++++++++++++++++ .pre-commit-config.yaml | 1 + 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/update_openapi_spec.yml diff --git a/.github/workflows/update_openapi_spec.yml b/.github/workflows/update_openapi_spec.yml new file mode 100644 index 0000000000000..012a95cb6afa6 --- /dev/null +++ b/.github/workflows/update_openapi_spec.yml @@ -0,0 +1,23 @@ +name: Update OpenAPI Spec + +on: + push: + branches: + - master + paths: + - '**/*openapi.yaml' + - '**/*openapi.yml' + workflow_dispatch: + +jobs: + update-openapi-spec: + runs-on: ubuntu-latest + + steps: + - name: Dispatch update spec workflow + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.PRO_ACCESS_TOKEN }} + repository: localstack/openapi + event-type: openapi-update + client-payload: '{"ref": "${{ github.ref }}", "repo": "${{ github.repository }}"}' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b44d5980aa4d..07465b71010df 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,3 +26,4 @@ repos: hooks: - id: openapi-spec-validator files: .*openapi.*\.(json|yaml|yml) + exclude: ^(tests/|.github/workflows/) From ee0790a9a3d41b420e7b52690811fcc7e14c2bbe Mon Sep 17 00:00:00 2001 From: Giovanni Grano Date: Mon, 21 Oct 2024 08:59:08 -0400 Subject: [PATCH 2/2] Some comments --- .github/workflows/update_openapi_spec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update_openapi_spec.yml b/.github/workflows/update_openapi_spec.yml index 012a95cb6afa6..07d28dee8eccf 100644 --- a/.github/workflows/update_openapi_spec.yml +++ b/.github/workflows/update_openapi_spec.yml @@ -14,10 +14,12 @@ jobs: runs-on: ubuntu-latest steps: + # This step dispatches a workflow in the OpenAPI repo, updating the spec and opening a PR. - name: Dispatch update spec workflow uses: peter-evans/repository-dispatch@v3 with: token: ${{ secrets.PRO_ACCESS_TOKEN }} repository: localstack/openapi event-type: openapi-update + # A git reference is needed when we want to dispatch the worflow from another branch. client-payload: '{"ref": "${{ github.ref }}", "repo": "${{ github.repository }}"}'