Trigger Vercel Push Notification #2988
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .github/workflows/cron.yml | |
| name: Trigger Vercel Push Notification | |
| on: | |
| schedule: | |
| # 範例:每 10 分鐘執行一次 | |
| # 注意:GitHub Actions 只有 "盡力而為" 的準確度,可能會延遲幾分鐘,對公車推播是可以接受的。 | |
| - cron: '*/10 * * * *' | |
| workflow_dispatch: # 允許在 GitHub 網頁上手動按按鈕觸發測試 | |
| jobs: | |
| cron-job: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Call Vercel Function | |
| run: | | |
| curl -X POST ${{ secrets.VERCEL_API_URL }} \ | |
| -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ | |
| -H "Content-Type: application/json" |