Update Notion Stats #10
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/update-notion-stats.yml (in production branch) | |
| name: Update Notion Stats | |
| on: | |
| schedule: | |
| - cron: '0 * * * *' # Fixed cron syntax - every hour | |
| workflow_dispatch: | |
| jobs: | |
| update-stats: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| # Checkout the static-landing-page branch where the code lives FIRST | |
| - name: Checkout static-landing-page branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: static-landing-page | |
| # Now setup Node.js without built-in caching (we handle caching manually) | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| # Cache node modules - scoped to static-landing-page branch and subfolder | |
| - name: Cache node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: static-landing-page-${{ runner.os }}-node-${{ hashFiles('turso-notion-integration/package-lock.json') }} | |
| restore-keys: | | |
| static-landing-page-${{ runner.os }}-node- | |
| # Cache previous stats - scoped to static-landing-page branch | |
| - name: Cache previous stats | |
| uses: actions/cache@v4 | |
| with: | |
| path: turso-notion-integration/.cache | |
| key: static-landing-page-turso-stats-${{ github.run_number }} | |
| restore-keys: | | |
| static-landing-page-turso-stats- | |
| - name: Install dependencies | |
| working-directory: turso-notion-integration | |
| run: npm ci --prefer-offline --no-audit | |
| - name: Update Notion with Turso data | |
| working-directory: turso-notion-integration | |
| env: | |
| TURSO_DATABASE_URL: ${{ secrets.TURSO_CONNECTION_URL }} | |
| TURSO_AUTH_TOKEN: ${{ secrets.TURSO_AUTH_TOKEN }} | |
| NOTION_TOKEN: ${{ secrets.NOTION_API_KEY }} | |
| NOTION_DATABASE_ID: ${{ secrets.NOTION_STATS_DATABASE_ID }} | |
| run: node update-notion-stats.js |