mirror of
https://github.com/ourongxing/newsnow.git
synced 2025-01-19 03:09:14 +08:00
feat(script): auto refresh data by action
This commit is contained in:
parent
96e80cff7b
commit
846da75445
20
.github/workflows/auto-refresh.yml
vendored
Normal file
20
.github/workflows/auto-refresh.yml
vendored
Normal 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
11
scripts/refresh.ts
Normal 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)
|
Loading…
x
Reference in New Issue
Block a user