Actualizar .gitea/workflows/update-types.yml
This commit is contained in:
@@ -1,19 +1,58 @@
|
|||||||
name: Update database types
|
name: Update database types
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- '*.sql'
|
- supabase/migrations/*.sql
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.head_ref != 'supabot**'
|
|
||||||
|
env:
|
||||||
|
SUPABASE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
PROJECT_REF: ${{ secrets.SUPABASE_PROJECT_ID }}
|
||||||
|
DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: lyqht/generate-supabase-db-types-github-action@main
|
- name: Checkout repo
|
||||||
with:
|
uses: actions/checkout@v4
|
||||||
SUPABASE_REF_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
|
with:
|
||||||
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
|
fetch-depth: 0
|
||||||
DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
|
|
||||||
OUTPUT_PATH: supabase/functions/_shared/database.types.ts
|
- name: Install Supabase CLI
|
||||||
|
run: |
|
||||||
|
curl -L https://github.com/supabase/cli/releases/latest/download/supabase_linux_amd64.tar.gz \
|
||||||
|
| tar -xz
|
||||||
|
sudo mv supabase /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Generate database types
|
||||||
|
run: |
|
||||||
|
supabase gen types typescript \
|
||||||
|
--project-id $PROJECT_REF \
|
||||||
|
--db-password $DB_PASSWORD \
|
||||||
|
> supabase/functions/_shared/database.types.ts
|
||||||
|
|
||||||
|
- name: Check for changes
|
||||||
|
id: git_status
|
||||||
|
run: |
|
||||||
|
if [[ -n "$(git status --porcelain)" ]]; then
|
||||||
|
echo "changed=true" >> $GITEA_OUTPUT
|
||||||
|
else
|
||||||
|
echo "changed=false" >> $GITEA_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
if: steps.git_status.outputs.changed == 'true'
|
||||||
|
run: |
|
||||||
|
git config user.name "supabot"
|
||||||
|
git config user.email "supabot@example.com"
|
||||||
|
git add supabase/functions/_shared/database.types.ts
|
||||||
|
git commit -m "chore: update database types"
|
||||||
|
|
||||||
|
- name: Push changes
|
||||||
|
if: steps.git_status.outputs.changed == 'true'
|
||||||
|
run: |
|
||||||
|
git push
|
||||||
Reference in New Issue
Block a user