Skip to content

ci: add code check action #1

ci: add code check action

ci: add code check action #1

Workflow file for this run

name: Code Check
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, reopened, synchronize]
env:
PNPM_VERSION: 9.12.2
jobs:
setup:
runs-on: ubuntu-latest
name: Setup pnpm and install dependencies
outputs:
pnpm_cache_dir: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup & Install Node.js
uses: actions/setup-node@v3
with:
node-version-file: .node-version
- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: ${{ env.PNPM_VERSION }}
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile
format:
runs-on: ubuntu-latest
needs: setup
name: pnpm lint:check
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ needs.setup.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm lint:check
type-check:
runs-on: ubuntu-latest
needs: setup
name: pnpm type-check
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ needs.setup.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm lint:typecheck