Setup/ci #7
Workflow file for this run
This file contains hidden or 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: CI | |
on: | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 10 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run format check on modified files | |
run: | | |
git fetch origin $GITHUB_BASE_REF | |
FILES=$(git diff --name-only origin/$GITHUB_BASE_REF...HEAD | grep -E '\.(js|ts|tsx|jsx|json|css|md)$' || true) | |
if [ -n "$FILES" ]; then | |
echo $FILES | xargs pnpm prettier --check | |
else | |
echo "No files to format" | |
fi | |
- name: Run lint on modified files | |
run: | | |
git fetch origin $GITHUB_BASE_REF | |
FILES=$(git diff --name-only origin/$GITHUB_BASE_REF...HEAD | grep -E '\.(js|ts|tsx|jsx)$') | |
if [ -n "$CHANGED_FILES" ]; then | |
echo $FILES | xargs pnpm lint | |
else | |
echo "No changed files for ESLint." | |
fi | |
- name: Run tests | |
run: pnpm run test |