Skip to content

Codegen

Codegen #2483

Workflow file for this run

name: Codegen
on:
workflow_dispatch:
schedule:
- cron: "0 0,12 * * *"
jobs:
update-models:
name: "Codegen: update models"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_GITHUB_TOKEN_PUBLIC }}
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate clients from models
run: pnpm codegen clients
- name: Regenerate lockfile
run: pnpm install --lockfile-only
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create or update clients pull request
uses: peter-evans/create-pull-request@v7
with:
add-paths: clients,pnpm-lock.yaml
branch: codegen/update-models
token: ${{ secrets.BOT_GITHUB_TOKEN_PUBLIC }}
title: "feat(clients): update models as of ${{ steps.date.outputs.date }}"
commit-message: "feat(clients): update models as of ${{ steps.date.outputs.date }}"
body: |
This is an automated pull request that was generated due to changes detected in the [Amazon Selling Partner API models](https://github.com/amzn/selling-partner-api-models).
The branch associated with this PR will be automatically updated if other changes occur.
delete-branch: true
reviewers: tusbar
update-schemas:
name: "Codegen: update schemas"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_GITHUB_TOKEN_PUBLIC }}
- uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate schemas
run: pnpm codegen schemas
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create or update schemas pull request
uses: peter-evans/create-pull-request@v7
with:
add-paths: packages/schemas
branch: codegen/update-schemas
token: ${{ secrets.BOT_GITHUB_TOKEN_PUBLIC }}
title: "feat(schemas): update schemas as of ${{ steps.date.outputs.date }}"
commit-message: "feat(schemas): update schemas as of ${{ steps.date.outputs.date }}"
body: |
This is an automated pull request that was generated due to changes detected in the [Amazon Selling Partner API models](https://github.com/amzn/selling-partner-api-models).
The branch associated with this PR will be automatically updated if other changes occur.
delete-branch: true
reviewers: tusbar