[github actions] Bump pnpm/action-setup from 3 to 4 (#21) #56
This file contains 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
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@v4 | |
# 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 |