Skip to content

🔄 re-generate JSON Schemas (#414) #12

🔄 re-generate JSON Schemas (#414)

🔄 re-generate JSON Schemas (#414) #12

name: Generate TypeScript Classes from JSONSchemas
on:
push:
paths:
- "json-schema-files/**.json"
branches:
- main
jobs:
generate:
name: Generate TypeScript Classes from JSONSchemas
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 14
- name: Install Code Generator
run: npm install json-schema-to-typescript -g
- name: Run Code Generator
run: json2ts -i 'json-schema-files/**.json' -o ts_models/
- name: Upload TypeScript Files
uses: actions/upload-artifact@master
with:
name: TypeScriptClasses
path: ts_models
- name: Push ts_models content to type script models repo
uses: cpina/github-action-push-to-another-repository@v1.7.2
env:
API_TOKEN_GITHUB: ${{ secrets.TS_MODELS_PUSH_TOKEN }} # this token expires on 2024-12-15
# token with repo scope
# Regenerate token: https://github.com/settings/tokens/1078258383/regenerate
# Update secret with regenerated token: https://github.com/Hochfrequenz/BO4E-dotnet/settings/secrets/actions/TS_MODELS_PUSH_TOKEN
with:
source-directory: "ts_models"
target-directory: "src"
destination-github-username: "Hochfrequenz"
destination-repository-name: "bo4e-dotnet-ts-models"
user-email: bo4e-dotnet@hochfrequenz.de
target-branch: main