From 0d3196fa0c23d791329a63b9a5603e9f2902d090 Mon Sep 17 00:00:00 2001 From: Nicola Puppa Date: Sat, 17 Aug 2024 15:42:31 +0200 Subject: [PATCH 1/5] 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 0000000000..275649adc1 --- /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 a3cebf1ec5..d3a6af0ebe 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 From a7965238890cf3ba913970360f176d8a0609048f Mon Sep 17 00:00:00 2001 From: Nicola Puppa Date: Thu, 29 Aug 2024 09:08:57 +0200 Subject: [PATCH 2/5] fix: remove unnecessary nvm script The image used for our GH runners contains nvm, likely we are using an older version of nvm not available in the runner --- .husky/pre-commit | 3 --- 1 file changed, 3 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index d3a6af0ebe..36af219892 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -# -#export NVM_DIR="$HOME/.nvm" -#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" npx lint-staged From e51df8019303186d50c5c6c095088abb66f9d3e8 Mon Sep 17 00:00:00 2001 From: Nicola Puppa Date: Thu, 29 Aug 2024 09:09:56 +0200 Subject: [PATCH 3/5] feat: add label deploy to create the PR preview --- .github/workflows/sync-rest-api-docs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-rest-api-docs.yaml b/.github/workflows/sync-rest-api-docs.yaml index 275649adc1..686e0f9b6b 100644 --- a/.github/workflows/sync-rest-api-docs.yaml +++ b/.github/workflows/sync-rest-api-docs.yaml @@ -47,3 +47,4 @@ jobs: delete-branch: true reviewers: camunda/tech-writers base: main + labels: deploy From 31d557c494c6a09ce43375fbd43b681b1f2bd44b Mon Sep 17 00:00:00 2001 From: Nicola Puppa Date: Thu, 29 Aug 2024 09:36:58 +0200 Subject: [PATCH 4/5] feat: improve PR description --- .github/workflows/sync-rest-api-docs.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-rest-api-docs.yaml b/.github/workflows/sync-rest-api-docs.yaml index 686e0f9b6b..506b96e808 100644 --- a/.github/workflows/sync-rest-api-docs.yaml +++ b/.github/workflows/sync-rest-api-docs.yaml @@ -41,7 +41,22 @@ jobs: token: "${{ secrets.GITHUB_TOKEN }}" path: docs title: Update camunda REST API doc - body: This PR updates the camunda REST API + body: | + ## Description + + This is an autogenerated PR by the [sync api specs workflow](https://github.com/camunda/camunda-docs/tree/main/.github/workflows/sync-rest-api-docs.yaml). + This PR contains every changes made to the REST api specs in the [monorepo](https://github.com/camunda/camunda/blob/main/zeebe/gateway-protocol/src/main/proto/rest-api.yaml) in the last week. + This PR contains also all the generated OpenAPI files related to the changes. + + ## When should this change go live? + + - There is **no urgency** with this change and can be released at any time. + + ## PR Checklist + + - My changes are for the **next minor** and are in `/docs` directory (aka `/next/`). + - My changes require a [technical writer review](https://github.com/camunda/camunda-docs/blob/main/howtos/documentation-guidelines.md#review-process), and I've assigned @camunda/tech-writers as a reviewer. + commit-message: "docs: update REST API spec" branch: update-rest-doc delete-branch: true From 48efee6dacbfea97146ba691d1428fb85dca5c0d Mon Sep 17 00:00:00 2001 From: Nicola Puppa Date: Thu, 29 Aug 2024 17:36:42 +0200 Subject: [PATCH 5/5] feat: add pepopowitz as reviewer --- .github/workflows/sync-rest-api-docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-rest-api-docs.yaml b/.github/workflows/sync-rest-api-docs.yaml index 506b96e808..ff158a18c3 100644 --- a/.github/workflows/sync-rest-api-docs.yaml +++ b/.github/workflows/sync-rest-api-docs.yaml @@ -60,6 +60,6 @@ jobs: commit-message: "docs: update REST API spec" branch: update-rest-doc delete-branch: true - reviewers: camunda/tech-writers + reviewers: camunda/tech-writers,pepopowitz base: main labels: deploy