Skip to content

ci: use github actions to check the code for linting and formatting errors #4

ci: use github actions to check the code for linting and formatting errors

ci: use github actions to check the code for linting and formatting errors #4

Workflow file for this run

name: pr
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
install:
name: install
runs-on: ubuntu-latest
steps:
# This step uses the actions/checkout action to download a copy of your repository on the runner.
- name: Checkout repo
uses: actions/checkout@v4
# This step uses the pnpm/action-setup action to set up pnpm on the runner.
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
# This step uses the actions/cache action to cache the pnpm store directory.
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
# This step uses the actions/cache action to cache the pnpm store directory.
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
# This step uses the actions/setup-node action to set up a Node.js environment on the runner.
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
# This step runs the install script for the selected node package manager.
- name: Install dependencies
run: pnpm install --frozen-lockfile
lint:
name: lint
needs: [install]
runs-on: ubuntu-latest
steps:
# This step uses the actions/checkout action to download a copy of your repository on the runner.
- name: Checkout repo
uses: actions/checkout@v4
# This step uses the pnpm/action-setup action to set up pnpm on the runner.
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
# This step uses the actions/setup-node action to set up a Node.js environment on the runner.
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
# This step runs the install script for the selected node package manager.
- name: Install dependencies
run: pnpm install --frozen-lockfile
# This step runs the test script if there is one specified under the scripts key in your package.json file.
- name: Run the linter to check for linting errors
run: pnpm ci:lint
format:
name: format
needs: [install]
runs-on: ubuntu-latest
steps:
# This step uses the actions/checkout action to download a copy of your repository on the runner.
- name: Checkout repo
uses: actions/checkout@v4
# This step uses the pnpm/action-setup action to set up pnpm on the runner.
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
# This step uses the actions/setup-node action to set up a Node.js environment on the runner.
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
# This step runs the install script for the selected node package manager.
- name: Install dependencies
run: pnpm install --frozen-lockfile
# This step runs the test script if there is one specified under the scripts key in your package.json file.
- name: Run the formatter to check for formatting errors
run: pnpm ci:format