Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,77 +77,3 @@ jobs:
- name: Test frontend
working-directory: ./frontend
run: npm test

update-schemas:
name: Update generated schemas

runs-on: ubuntu-latest

# Only run on push to main/master, not on PRs
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')

permissions:
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install dependencies
run: |
npm install
cd scripts && uv sync

- name: Build utils
working-directory: ./utils
run: npm run build

- name: Regenerate schemas
run: |
cd utils && npx tsx src/export-schemas.ts
npx prettier --write ../docs/assets/api/schemas.json
cd ../scripts && uv run datamodel-codegen \
--input ../docs/assets/api/schemas.json \
--output deliberate_lab/types.py \
--input-file-type jsonschema \
--reuse-model \
--collapse-root-models \
--use-union-operator \
--use-title-as-name \
--output-model-type pydantic_v2.BaseModel \
--custom-file-header $'# pyright: reportInvalidTypeForm=false\n# pylint: disable=missing-module-docstring,missing-class-docstring,invalid-name,too-few-public-methods'

- name: Format Python files
run: |
cd scripts && uvx black deliberate_lab/

- name: Validate generated Python
run: |
cd scripts && uv run pyright deliberate_lab/

- name: Create PR if schemas changed
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update generated schemas and Python types"
title: "chore: update generated schemas and Python types"
body: "🤖 Auto-generated by GitHub Actions"
branch: auto-update-schemas
add-paths: |
docs/assets/api/schemas.json
scripts/deliberate_lab/
116 changes: 49 additions & 67 deletions docs/assets/api/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@
"items": {
"type": "string"
}
},
"youtubeVideoId": {
"type": "string"
}
},
"required": [
Expand Down Expand Up @@ -1005,28 +1008,9 @@
"type": "string"
},
"type": {
"allOf": [
{
"anyOf": [
{
"const": "static",
"type": "string"
},
{
"const": "random_permutation",
"type": "string"
},
{
"const": "balanced_assignment",
"type": "string"
}
]
},
{
"const": "static",
"type": "string"
}
]
"default": "static",
"const": "static",
"type": "string"
},
"scope": {
"anyOf": [
Expand Down Expand Up @@ -1255,28 +1239,9 @@
"type": "string"
},
"type": {
"allOf": [
{
"anyOf": [
{
"const": "static",
"type": "string"
},
{
"const": "random_permutation",
"type": "string"
},
{
"const": "balanced_assignment",
"type": "string"
}
]
},
{
"const": "random_permutation",
"type": "string"
}
]
"default": "random_permutation",
"const": "random_permutation",
"type": "string"
},
"scope": {
"anyOf": [
Expand Down Expand Up @@ -1363,28 +1328,9 @@
"type": "string"
},
"type": {
"allOf": [
{
"anyOf": [
{
"const": "static",
"type": "string"
},
{
"const": "random_permutation",
"type": "string"
},
{
"const": "balanced_assignment",
"type": "string"
}
]
},
{
"const": "balanced_assignment",
"type": "string"
}
]
"default": "balanced_assignment",
"const": "balanced_assignment",
"type": "string"
},
"scope": {
"anyOf": [
Expand Down Expand Up @@ -1894,9 +1840,45 @@
},
"progress": {
"$ref": "#/$defs/StageProgressConfig"
},
"timeLimitInMinutes": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"requireFullTime": {
"type": "boolean"
},
"isTurnBasedChat": {
"type": "boolean"
},
"minNumberOfTurns": {
"type": "number"
},
"maxNumberOfTurns": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
]
}
},
"required": ["id", "kind", "name", "descriptions", "progress"],
"required": [
"id",
"kind",
"name",
"descriptions",
"progress",
"timeLimitInMinutes"
],
"title": "PrivateChatStageConfig"
},
"ProfileStageConfig": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
]
},
"scripts": {
"prepare": "husky"
"prepare": "husky",
"update-schemas": "npm run build --workspace=utils && npx tsx utils/src/export-schemas.ts && npx prettier --write docs/assets/api/schemas.json && cd scripts && uv run datamodel-codegen --input ../docs/assets/api/schemas.json --output deliberate_lab/types.py --input-file-type jsonschema --reuse-model --collapse-root-models --use-union-operator --use-title-as-name --use-one-literal-as-default --output-model-type pydantic_v2.BaseModel --custom-file-header '# pyright: reportInvalidTypeForm=false\n# pylint: disable=missing-module-docstring,missing-class-docstring,invalid-name,too-few-public-methods' && uv run black deliberate_lab/ && uv run pyright deliberate_lab/"
},
"workspaces": [
"frontend",
Expand Down
Loading