// package.json
{
  "scripts": {
    "lint": "eslint \\"{src,apps,libs,test}/**/*.ts\\" --fix",
    "prettier": "prettier --write **/*.{ts,tsx}",
    "format": "yarn lint && yarn prettier"
    "format-check": "eslint \\"{src,apps,libs,test}/**/*.ts\\" && prettier --check **/*.{ts,tsx}"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^8.11.0",
    "@typescript-eslint/parser": "^8.11.0",
    "eslint": "^8.42.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.0",
    "prettier": "^3.0.0"
  }
}
// check.yml
name: CI Pipeline

on: 
  pull_request:
    types: [opened, reopened, synchronize]
    branches:
      - test/CI

jobs:
  build:
    name: Lint, Build and Test
    runs-on: ubuntu-latest

    strategy:
      matrix:
        project: [frontend, backend]

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 2

      - name: Check for changes in ${{ matrix.project }}
        id: changes
        run: |
          if git diff --name-only HEAD^ HEAD | grep -q "^${{ matrix.project }}/"; then
            echo "changed=true" >> $GITHUB_ENV
          else
            echo "changed=false" >> $GITHUB_ENV
          fi

      - name: Install Dependencies for ${{ matrix.project }}
        if: env.changed == 'true'
        run: yarn install
        working-directory: ${{ matrix.project }}

      - name: Lint ${{ matrix.project }}
        if: env.changed == 'true'
        run: yarn format-check
        working-directory: ${{ matrix.project }}
        
      - name: Build ${{ matrix.project }}
        if: env.changed == 'true'
        run: yarn build
        working-directory: ${{ matrix.project }}

      # - name: Test ${{ matrix.project }}
      #   if: env.changed == 'true'
      #   run: yarn test
      #   working-directory: ${{ matrix.project }}

참고

Github Actions를 이용한 CI 구축하기(Prettier, ESLint, TSC)

Todo. 테스트를 위한 최소한의 의존성만 설치할순 없을까?

함께 알아보아요