-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.53 KB
/
pull-request-build-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Perform a build check when a PR is opened
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
# This action checks out the repository's code onto the runner.
# This is necessary so that the workflow can access and operate on the code.
- name: Checkout
uses: actions/checkout@v4
# https://github.com/actions/setup-node
# This action sets up a specific version of Node.js on the runner.
# It also caches the specified package manager (in this case, yarn) for faster future runs.
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
# https://github.com/actions/cache
# This action restores cache from a key.
# It helps to reduce the time to install dependencies by reusing the previously cached dependencies.
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# Change the cache only when the package file is changed, not the source file.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package.json', '**/yarn.lock') }}-
- name: Install dependencies
run: yarn install
- name: Build with Next.js
run: yarn build