chore: update workflow action

This commit is contained in:
Ou 2024-10-21 23:09:26 +08:00
parent cacf33a1e4
commit 8ffd77b2eb
2 changed files with 12 additions and 10 deletions

View File

@ -17,4 +17,7 @@ jobs:
with: with:
node-version: lts/* node-version: lts/*
- run: npx tsx ./scripts/refresh.ts - name: Refresh
env:
JWT_TOKEN: ${{ secrets.JWT_TOKEN }}
run: npx tsx ./scripts/refresh.ts

View File

@ -1,11 +1,10 @@
import process from "node:process"
import { sources } from "../shared/sources" import { sources } from "../shared/sources"
import { delay } from "../shared/utils"
async function main() { Promise.all(Object.keys(sources).map(id =>
for (const id of Object.keys(sources)) { fetch(`https://newsnow.busiyi.world/api/s/${id}?latest`, {
await delay(100) headers: {
fetch(`https://newsnow.busiyi.world/api/s/${id}`) Authorization: `Bearer ${process.env.JWT_TOKEN}`,
} },
} }),
)).catch(console.error)
main().catch(console.error)