From 0d3196fa0c23d791329a63b9a5603e9f2902d090 Mon Sep 17 00:00:00 2001 From: Nicola Puppa Date: Sat, 17 Aug 2024 15:42:31 +0200 Subject: [PATCH] feat(rest-api-automation): add workflow to update camunda rest api --- .github/workflows/sync-rest-api-docs.yaml | 49 +++++++++++++++++++++++ .husky/pre-commit | 6 +-- 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/sync-rest-api-docs.yaml diff --git a/.github/workflows/sync-rest-api-docs.yaml b/.github/workflows/sync-rest-api-docs.yaml new file mode 100644 index 00000000000..275649adc1a --- /dev/null +++ b/.github/workflows/sync-rest-api-docs.yaml @@ -0,0 +1,49 @@ +name: Sync Camunda REST API + +on: + schedule: + - cron: "0 15 * * 4" # Runs every Thursday at 3 PM UTC + workflow_dispatch: + +jobs: + sync-file: + runs-on: ubuntu-latest + + steps: + - name: Checkout Camunda docs repository + uses: actions/checkout@v3 + with: + repository: camunda/camunda-docs + path: docs + + - name: Checkout Camunda repository + uses: actions/checkout@v3 + with: + repository: camunda/camunda + path: rest-spec + sparse-checkout: zeebe/gateway-protocol/src/main/proto/rest-api.yaml + sparse-checkout-cone-mode: false + + - name: Sync documentation + run: | + cd docs + mv ../rest-spec/zeebe/gateway-protocol/src/main/proto/rest-api.yaml api/camunda/camunda-openapi.yaml + npm i + npm run api:generate:camunda + if git diff-index --quiet HEAD; then + echo "No changes to commit." + exit 0 + fi + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + path: docs + title: Update camunda REST API doc + body: This PR updates the camunda REST API + commit-message: "docs: update REST API spec" + branch: update-rest-doc + delete-branch: true + reviewers: camunda/tech-writers + base: main diff --git a/.husky/pre-commit b/.husky/pre-commit index a3cebf1ec5c..d3a6af0ebe0 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,7 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" - -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +# +#export NVM_DIR="$HOME/.nvm" +#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" npx lint-staged