Skip to content

Commit

Permalink
feat(rest-api-automation): add workflow to update camunda rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpuppa committed Aug 26, 2024
1 parent fadd568 commit 3f0ff02
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/sync-rest-api-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Sync Camunda REST API

on:
pull_request:
branches:
- main
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: Set branch name environment variable
run: |
cd docs
echo "BRANCH_NAME=update-$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Create a new branch with the current date
run: |
cd docs
git checkout -b ${{ env.BRANCH_NAME }}
- name: Sync documentation
run: |
cd docs
mv ../rest-spec/zeebe/gateway-protocol/src/main/proto/rest-api.yaml api/camunda/camunda-openapi.yaml
ls -lah
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: ${{ env.BRANCH_NAME }}
base: "main"
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3f0ff02

Please sign in to comment.