Scheduled Cloudflare Rebuild Trigger #3
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/rebuild.yml | |
| # 1. ADD NAME (Shows up in the Actions tab) | |
| name: Manual and Scheduled Rebuild | |
| # 2. ADD TRIGGERS (Defines WHEN the workflow runs) | |
| on: | |
| # Allows manual triggering via the GitHub Actions UI ("Run workflow" button) | |
| workflow_dispatch: | |
| # Optional: Keep or delete this if you don't want a schedule | |
| schedule: | |
| # Runs daily at 00:00 UTC (Adjust this if you need a specific time) | |
| - cron: '0 0 * * *' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Check out the repository code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # Step 2: Set up Node.js environment | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| # Step 3: Install project dependencies | |
| - name: Install dependencies | |
| run: npm install | |
| # Step 4: RUN THE FLICKR FETCH SCRIPT | |
| - name: Fetch Flickr Photos | |
| run: npm run fetch:flickr | |
| env: | |
| FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }} | |
| # Step 5: Trigger Cloudflare Pages Build Hook | |
| - name: Trigger Cloudflare Pages Build Hook | |
| run: | | |
| curl -X POST "${{ secrets.CLOUDFLARE_BUILD_HOOK }}" |