This repository has been archived by the owner on Jan 14, 2024. It is now read-only.
Update database types #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update database types | |
on: | |
schedule: | |
# sets the action to run daily. You can modify this to run the action more or less frequently | |
- cron: '0 * * * *' | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
env: | |
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
PROJECT_REF: ${{ secrets.SUPABASE_REF_ID }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: develop | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/[email protected] | |
with: | |
node-version: 16 | |
- run: pnpm supabase gen types typescript --project-id ${SUPABASE_REF_ID} > src/lib/shared/supabase/database.types.ts | |
- name: check for file changes | |
id: git_status | |
run: | | |
echo "::set-output name=status::$(git status -s)" | |
- name: Commit files | |
if: ${{contains(steps.git_status.outputs.status, ' ')}} | |
run: | | |
git add src/lib/shared/supabase/database.types.ts | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "chore: update Supabase database types" -a | |
- name: Push changes | |
if: ${{contains(steps.git_status.outputs.status, ' ')}} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |