Automatically detect missing updates to OpenAPI specs and client #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: OpenAPI | |
on: | |
pull_request: | |
paths: | |
- 'server/application-server/**' | |
- '.github/workflows/generate-api-client.yml' | |
workflow_dispatch: | |
jobs: | |
generate-api-client: | |
name: Update API Specs and Client | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Install dependencies | |
run: npm install | |
- name: Generate API client | |
run: npm run generate:api | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if [[ -z $(git status --porcelain) ]]; then | |
echo "no_changes=true" >> $GITHUB_ENV | |
else | |
echo "no_changes=false" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.no_changes == 'false' | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "chore: update API client" | |
git push origin HEAD:${{ github.head_ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |