-
Notifications
You must be signed in to change notification settings - Fork 8
56 lines (45 loc) · 1.48 KB
/
pr-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
44
45
46
47
48
49
50
51
52
53
54
55
56
name: PR Check
on:
# Run workflow when a PR is merged onto main
push:
branches:
- main
# Run workflow on any open PR against main branch
pull_request:
types: ['opened', 'reopened', 'ready_for_review', 'synchronize']
branches:
- main
# cancel in progress workflows for the same PR if new commits are added
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
pr-check:
if: ${{ github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
env:
NODE_ENV: development
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
# Checkout repository files
- name: Checkout repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
# Add Node.js and npm to runner
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc' # sets node version from .nvmrc file
cache: 'pnpm'
- name: Authenticate with private NPM package
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
# Install project dependencies with pnpm
- name: Install dependencies
env:
# Note: NODE_ENV needs to be set to development to
# install jest and other dev dependencies
NODE_ENV: development
run: pnpm install
# Check for linting errors
- name: Check for linting errors
run: pnpm lint