🔨 Generate frontend SDK on pre-commit, remove custom workflow (#2111)
This commit is contained in:
committed by
GitHub
parent
da603ebaac
commit
0564d65041
53
.github/workflows/generate-client.yml
vendored
53
.github/workflows/generate-client.yml
vendored
@@ -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)
|
||||
4
.github/workflows/pre-commit.yml
vendored
4
.github/workflows/pre-commit.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user