Weekly Quality Check #4
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: Weekly Quality Check | |
| on: | |
| schedule: | |
| - cron: '0 9 * * 1' | |
| workflow_dispatch: | |
| jobs: | |
| quality: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Prepare pnpm | |
| if: hashFiles('pnpm-lock.yaml') != '' | |
| run: | | |
| corepack enable | |
| if node -e "const pm=require('./package.json').packageManager||''; process.exit(pm.startsWith('pnpm@')?0:1)"; then | |
| corepack install | |
| else | |
| corepack prepare pnpm@10.32.1 --activate | |
| fi | |
| - name: Install dependencies | |
| run: | | |
| if [ -f pnpm-lock.yaml ]; then | |
| pnpm install --frozen-lockfile --ignore-scripts | |
| elif [ -f package-lock.json ]; then | |
| npm ci --ignore-scripts | |
| elif [ -f yarn.lock ]; then | |
| corepack enable | |
| yarn install --immutable | |
| else | |
| npm install --ignore-scripts | |
| fi | |
| - name: Run available quality scripts | |
| run: | | |
| run_script() { | |
| local script="$1" | |
| if node -e "const s=require('./package.json').scripts||{}; process.exit(s[process.argv[1]]?0:1)" "$script"; then | |
| if [ -f pnpm-lock.yaml ]; then | |
| pnpm run "$script" | |
| elif [ -f yarn.lock ]; then | |
| yarn "$script" | |
| else | |
| npm run "$script" | |
| fi | |
| else | |
| echo "No $script script" | |
| fi | |
| } | |
| run_script lint | |
| run_script typecheck | |
| run_script test | |
| run_script build |