vercelgithub-actions
Vercel 무료 플랜에서 시간별 크론 돌리기
Vercel Hobby 플랜의 크론은 하루 1회가 한계다. 0 * * * * 를 넣으면 배포 자체가 거부된다.
Error: Hobby accounts are limited to daily cron jobs.
RSS 수집처럼 매시간 돌아야 하는 작업이 있다면, 크론만 GitHub Actions로 빼면 된다. 퍼블릭/프라이빗 레포 모두 스케줄 워크플로는 무료다.
# .github/workflows/ingest.yml
name: hourly-ingest
on:
schedule:
- cron: "10 * * * *"
workflow_dispatch: {}
jobs:
ingest:
runs-on: ubuntu-latest
steps:
- run: |
curl -sf "https://backtick.blog/api/ingest" \
-H "Authorization: Bearer ${{ secrets.CRON_SECRET }}"
엔드포인트 쪽은 시크릿 검증만 해주면 끝.
export async function GET(request: Request) {
const auth = request.headers.get("authorization");
if (auth !== `Bearer ${process.env.CRON_SECRET}`) {
return NextResponse.json({ error: "unauthorized" }, { status: 401 });
}
return NextResponse.json({ results: await ingestAllFeeds() });
}
조회 2