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:
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 { delay } from "../shared/utils"
async function main() {
for (const id of Object.keys(sources)) {
await delay(100)
fetch(`https://newsnow.busiyi.world/api/s/${id}`)
}
}
main().catch(console.error)
Promise.all(Object.keys(sources).map(id =>
fetch(`https://newsnow.busiyi.world/api/s/${id}?latest`, {
headers: {
Authorization: `Bearer ${process.env.JWT_TOKEN}`,
},
}),
)).catch(console.error)