Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lavinia Talpas authored and Lavinia Talpas committed Oct 10, 2024
1 parent 60b4f81 commit 58db12b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/generate-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,25 @@ jobs:
echo "api_changed=false" >> $GITHUB_ENV
fi
- name: Install dependencies using Yarn
if: env.api_changed == 'true'
run: yarn install --frozen-lockfile

- name: Install ts-node globally
if: env.api_changed == 'true'
run: yarn global add ts-node

- name: Install openapi-generator-cli globally
if: env.api_changed == 'true'
run: yarn global add @openapitools/openapi-generator-cli

- name: Generate SDK only if API changed
if: env.api_changed == 'true'
env:
NODE_OPTIONS: "--experimental-specifier-resolution=node --loader ts-node/esm --no-warnings"
run: |
mv new_api.yaml api.yaml
npx @openapitools/openapi-generator-cli generate -i api.yaml -g typescript-fetch -o .
openapi-generator-cli generate -i api.yaml -g typescript-fetch -o .
- name: Commit and push changes
if: env.api_changed == 'true'
Expand All @@ -49,4 +63,4 @@ jobs:
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Auto-update SDK based on new API file"
git push
git push

0 comments on commit 58db12b

Please sign in to comment.