feat(script): auto refresh data by action

This commit is contained in:
Ou 2024-10-19 15:08:42 +08:00
parent 96e80cff7b
commit 846da75445
2 changed files with 31 additions and 0 deletions

20
.github/workflows/auto-refresh.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Auto Refresh
on:
schedule:
- cron: '20 0-17,22,23 * * *'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npx tsx ./scripts/refresh.ts

11
scripts/refresh.ts Normal file
View File

@ -0,0 +1,11 @@
import { sources } from "../shared/sources"
import { delay } from "../shared/utils"
async function main() {
for (const id of Object.keys(sources)) {
await delay(100)
fetch(`https:newsnow.busiyi/api/s/${id}`)
}
}
main().catch(console.error)