Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lyqht committed Apr 11, 2022
1 parent 16ae10a commit fdc2a95
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# GitHub action to generate Supabase Database types

This GitHub action workflow aims to help you to create Supabase database definition types based on the Swagger OpenAPI specification of your Supabase REST data endpoint.

## What it does

This workflow is a composite action:

- To generate database types based on the Swagger OpenAPI specification of your Supabase project REST data endpoint, [openapi-typescript](https://github.com/drwpow/openapi-typescript) is used.
- Checking for file changes is done using the [get-diff-action](https://github.com/technote-space/get-diff-action).
- Commit and push github actions to your repo are performed by the [git-auto-commit action](https://github.com/stefanzweifel/git-auto-commit-action).

## How to use

If you are new to GitHub Actions, refer to [this section](#if-you-dont-have-an-existing-github-action-workflow-for-your-repository). Otherwise, you can get started by referring to to the example given and the input options available.

### Example

```yml
name: Update database types
on:
schedule:
- cron: '*/60 * * * *'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: lyqht/generate-supabase-database-types@main
with:
SUPABASE_URL: ${{secrets.SUPABASE_URL }} # e.g. https://interestingproject.supabase.co
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
OUTPUT_PATH: src/types/supabase.ts
```
### If you don't have an existing GitHub Action workflow for your repository
1. Create a folder `.github/workflows` if you don't have it already
2. Inside that folder, create a YAML file say `article-badge.yml`
3. In the `article-badge.yml` file, you can copy the example above and modify it to your usage.
4. You can choose to declare the `schedule` with a cron expression to run the job at a specified frequency e.g. every day once.

0 comments on commit fdc2a95

Please sign in to comment.