Skip to content

Commit 6850ca8

Browse files
authored
Biz/dj 2899 create a GitHub action to upsert any changed app files into (#15614)
* Add new action * Touch a file * Change trigger type * Remove unnecessary arguments from the action * Fix path * Fix path * Fix path * Add dist directory * Add license * Add lock file * Add index and package.json * Touch file * Process changed files and push to supabase * Add supabase key requirement * Debug * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Update index.js * Cleanup * Update README.md * Update workflow file * Use supabase uri from env * Set action node version to 20
1 parent 96ff26e commit 6850ca8

File tree

8 files changed

+46132
-0
lines changed

8 files changed

+46132
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Push registry app files to Supabase
2+
3+
This action pushes new and modified `*.app.mjs/*.app.ts` files to Supabase.
4+
5+
## Inputs
6+
7+
### `changed_files`
8+
9+
**Required** List of changed files.
10+
11+
### `supabase_anon_key`
12+
13+
**Required** Supabase key
14+
15+
```
16+
...
17+
with:
18+
format: json
19+
```
20+
21+
in that way `steps.changed_files.outputs.all` will be converted into an array of strings
22+
23+
## Example usage
24+
25+
```yaml
26+
- name: Upload modified or newly added *.app.mjs files to Supabase
27+
uses: ./.github/actions/push-registry-app-files-supabase
28+
with:
29+
changed_files: ${{ steps.changed_files.outputs.all }}
30+
supabase_anon_key: ${{ secrets.SUPABASE_ANON_KEY }}
31+
```
32+
33+
## Local Development + Build
34+
35+
Run the following command from this action directory to update `dist/index.js` if `src/index.js` has been modified:
36+
```bash
37+
cd .github/actions/push-registry-app-files-supabase
38+
npm run dev
39+
```
40+
41+
The above command will build and run the dist/index.js. Commit the `dist` directory.
42+
You might want to change the `on` trigger to `push` event on your local branch when making changes to the action so you
43+
can test it on GitHub:
44+
45+
## Master
46+
```yaml
47+
# .github/workflows/push-registry-app-files-supabase.yaml
48+
on:
49+
pull_request:
50+
branches:
51+
- master
52+
paths:
53+
- 'components/**'
54+
```
55+
56+
## During development
57+
```yaml
58+
# .github/workflows/push-registry-app-files-supabase.yaml
59+
on:
60+
push:
61+
branches:
62+
- feature-branch-name
63+
paths:
64+
- 'components/**'
65+
- '.github/actions/push-registry-app-files-supabase/**'
66+
```
67+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Push registry app files to Supabase"
2+
description: "Push registry app files that have changed to Supabase. If any *app.ts files have changed, run pnpm build for the affected app to generate the *.app.mjs file."
3+
inputs:
4+
changed_files:
5+
description: "List of all changed files coming from the push_to_supabase job of a github action workflow"
6+
required: true
7+
supabase_anon_key:
8+
description: "Supabase anon key"
9+
required: true
10+
supabase_uri:
11+
description: "Supabase URI"
12+
required: true
13+
runs:
14+
using: "node20"
15+
main: "dist/index.js"

0 commit comments

Comments
 (0)