Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from Cloudflare Cron Triggers to Deno Cron #56

Merged
merged 16 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PORT=8080
WEBHOOK_TOKEN="❤"
DISCORD_APPLICATION_ID="❤"
DISCORD_TOKEN="❤"
DISCORD_PUBLIC_KEY="❤"
DISCORD_WEBHOOK_URL="❤"
DISCORD_CHANNEL_ID="❤"
KV_URL="❤"
28 changes: 0 additions & 28 deletions .github/workflows/cf.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
- name: Lint
run: deno lint && git diff-index --quiet HEAD

- name: Test
run: deno task test
# - name: Test
# run: deno task test
24 changes: 1 addition & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,7 @@ The server is automatically deployed on push to the `main` branch via

### Daily webhook invocation

The daily webhook is invoked by making a POST request to the `/webhook/:token`
endpoint.

Set up a cron job to make the request at the desired time. Supabase supports
cron jobs via the
[pg_cron](https://supabase.com/docs/guides/database/extensions/pg_cron)
extension.

```sql
select cron.unschedule('lc-daily');

select
cron.schedule(
'lc-daily',
'0 0 * * *', -- https://crontab.guru/#0_0_*_*_*
$$
select
net.http_post(
url:='...',
) as request_id;
$$
);
```
The daily webhook is invoked by a daily Deno Cron job.

---

Expand Down
16 changes: 8 additions & 8 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"lock": "./deno.lock",
"tasks": {
"udd": "deno run -r --allow-read=. --allow-write=. --allow-net https://deno.land/x/udd/main.ts deps.ts && deno task lock",
"lock": "deno cache --lock-write deps.ts",
"all": "deno task udd && deno lint && deno fmt",
"test": "deno test --unstable",
"start": "deno run -A --unstable main.ts",
"test": "deno test --unstable-kv",
"start": "deno run -A --unstable-kv main.ts",
"ngrok": "ngrok http 8080",
"cf:push": "deno run -A tasks/cf/dailies/push/main.ts",
"cf:serve": "deno run -A tasks/cf/dailies/serve/main.ts",
"dnt": "deno run -A tasks/dnt/main.ts"
},
"imports": {
"@discord-applications/app": "jsr:@discord-applications/app@^0.0.4",
"@fartlabs/rt": "jsr:@fartlabs/rt@^0.0.3",
"@std/assert": "jsr:@std/assert@^0.225.3",
"@std/datetime": "jsr:@std/datetime@^0.224.0",
"@std/ulid": "jsr:@std/ulid@^0.224.0",
"discord-api-types": "npm:discord-api-types@^0.37.93",
"lc-dailies/": "./"
},
"fmt": {
Expand Down
366 changes: 255 additions & 111 deletions deno.lock

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions deps.ts

This file was deleted.

45 changes: 0 additions & 45 deletions env.ts

This file was deleted.

Loading
Loading