diff --git a/.github/workflows/generate-client.yml b/.github/workflows/generate-client.yml deleted file mode 100644 index 26303fb2d6..0000000000 --- a/.github/workflows/generate-client.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Generate Client - -on: - pull_request: - types: - - opened - - synchronize - -jobs: - generate-client: - permissions: - contents: write - runs-on: ubuntu-latest - steps: - # For PRs from forks - - uses: actions/checkout@v6 - # For PRs from the same repo - - uses: actions/checkout@v6 - if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) - with: - ref: ${{ github.head_ref }} - token: ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }} - - uses: oven-sh/setup-bun@v2 - - uses: actions/setup-python@v6 - with: - python-version: "3.10" - - name: Install uv - uses: astral-sh/setup-uv@v7 - - name: Install dependencies - run: bun ci - - run: uv sync - working-directory: backend - - run: bash scripts/generate-client.sh - env: - SECRET_KEY: just-for-generating-client - POSTGRES_PASSWORD: just-for-generating-client - FIRST_SUPERUSER_PASSWORD: just-for-generating-client - - name: Add changes to git - run: | - git config --local user.email "github-actions@github.com" - git config --local user.name "github-actions" - git add frontend/src/client - # Same repo PRs - - name: Push changes - if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) - run: | - git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client" - git push - # Fork PRs - - name: Check changes - if: ( github.event_name == 'pull_request' && github.secret_source != 'Actions' ) - run: | - git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ea3a6475a7..b609751643 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -66,13 +66,13 @@ jobs: if git diff --staged --quiet; then echo "No changes to commit" else - git commit -m "🎨 Auto format" + git commit -m "🎨 Auto format and update with pre-commit" git push fi - uses: pre-commit-ci/lite-action@v1.1.0 if: env.HAS_SECRETS == 'false' with: - msg: 🎨 Auto format + msg: 🎨 Auto format and update with pre-commit - name: Error out on pre-commit errors if: steps.precommit.outcome == 'failure' run: exit 1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9360a82b3c..fc718ea90d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,3 +39,10 @@ repos: require_serial: true language: unsupported types: [python] + + - id: generate-frontend-sdk + name: Generate Frontend SDK + entry: bash ./scripts/generate-client.sh + pass_filenames: false + language: unsupported + files: ^backend/.*$|^scripts/generate-client\.sh$ diff --git a/package.json b/package.json index db1783f9c0..ab558ed403 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "workspaces": [ "frontend" ], - "scripts": { + "scripts": { "dev": "bun run --filter frontend dev", "lint": "bun run --filter frontend lint", "test": "bun run --filter frontend test",