Skip to content

testing another action. #8

testing another action.

testing another action. #8

name: Update bundled openapi definition & Generate SDK
on:
push:
branches:
- add-new-api-folder-for-the-current-version
workflow_dispatch:
schedule:
- cron: '0 7 * * *' # At 07:00 every day
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch latest OpenAPI definition
shell: bash
run: |
curl -s https://openapi-v2.exoscale.com/source.yaml -o api/openapi.yaml
- name: Check for changes in OpenAPI definition
id: changes
run: |
git diff --exit-code api/openapi.yaml || echo "CHANGED=true" >> $GITHUB_ENV
- name: Delete existing SDK if OpenAPI definition has changed
if: env.CHANGED == 'true'
run: |
rm -rf sdk/*
- name: Generate code if OpenAPI definition has changed
if: env.CHANGED == 'true'
run: |
mvn generate-sources process-resources
cd sdk
mvn install
cd ..
- name: Commit and push changes if OpenAPI definition has changed
if: env.CHANGED == 'true'
run: |-
git config user.name "Automated"
git config user.email "actions@users.noreply.github.com"
git add .
timestamp=$(date -u)
git commit -m "OpenAPI spec and SDK update: ${timestamp}" || exit 0
git push