name: Keep caches warm # **What it does**: Makes sure the caching of ./node_modules and ./.next # is kept warm for making pull requests more rapid. # **Why we have it**: A PR workflow that depends on caching can't reuse a # cached artifact acorss PRs unless it also runs on `main`. # **Who does it impact**: Docs engineering, open-source engineering contributors. on: workflow_dispatch: push: branches: - main permissions: contents: read jobs: keep-caches-warm: if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }} steps: - name: Check out repo uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: ./.github/actions/node-npm-setup - name: Cache nextjs build uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 with: path: .next/cache key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }} - name: Build run: npm run build - uses: ./.github/actions/warmup-remotejson-cache