feat: shared build #20
Workflow file for this run
This file contains 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: Lint staged | |
on: [push] | |
jobs: | |
eslint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: install pnpm | |
shell: bash | |
run: | | |
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json) | |
echo installing pnpm version $PNPM_VER | |
npm i -g pnpm@$PNPM_VER | |
- uses: technote-space/get-diff-action@v6 | |
with: | |
PATTERNS: | | |
apps/**/*.+(ts|tsx|jsx|js) | |
.github/workflows/lint.yml | |
- uses: actions/setup-node@v3 | |
if: env.GIT_DIFF | |
with: | |
node-version: '18' | |
cache: 'pnpm' | |
cache-dependency-path: '**/pnpm-lock.yaml' | |
- run: echo ${{ env.GIT_DIFF }} | |
- run: pnpm install --ignore-scripts | |
if: env.GIT_DIFF | |
- name: Eslint Checker | |
if: env.GIT_DIFF | |
run: | | |
echo "修复命令 npx eslint --no-error-on-unmatched-pattern --fix --quiet ${{ env.GIT_DIFF_FILTERED }}" | |
pnpm eslint --no-error-on-unmatched-pattern --quiet ${{ env.GIT_DIFF_FILTERED }} |