1
0
mirror of synced 2025-12-30 03:01:36 -05:00

must run on pushes to make cache warm (#33491)

This commit is contained in:
Peter Bengtsson
2022-12-14 15:24:52 +01:00
committed by GitHub
parent 0c1e83dccd
commit f36a378753
3 changed files with 58 additions and 7 deletions

48
.github/workflows/keep-caches-warm.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Cache node_modules
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }}
- name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
cache: npm
- name: Install dependencies
run: npm install --prefer-offline --no-audit --ignore-scripts
- name: Cache nextjs build
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('package*.json') }}
- name: Build
run: npm run build

View File

@@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.15.0'
node-version: '16.17.0'
cache: npm
- name: Install dependencies

View File

@@ -7,9 +7,6 @@ name: 'Link Checker: On PR'
on:
workflow_dispatch:
merge_group:
push:
branches:
- main
pull_request:
permissions:
@@ -31,14 +28,20 @@ jobs:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Cache node_modules
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }}
- name: Setup node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.15.0'
node-version: '16.17.0'
cache: npm
- name: Install
run: npm ci --ignore-scripts
- name: Install dependencies
run: npm install --prefer-offline --no-audit --ignore-scripts
- name: Figure out which docs-early-access branch to checkout, if internal repo
if: ${{ github.repository == 'github/docs-internal' }}