-
Notifications
You must be signed in to change notification settings - Fork 6
40 lines (31 loc) · 1.08 KB
/
react_lint_and_format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: React Lint on PR
on:
pull_request:
paths:
- "apps/dashboard/**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17"
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: cd apps/dashboard && pnpm install
- name: Get list of changed files
id: getfile
run: |
echo "Changed files:"
git fetch origin ${{ github.event.pull_request.base.ref }} # fetch the base branch
files=$(git diff --name-only FETCH_HEAD..HEAD | grep 'apps/dashboard/.*\.\(js\|jsx\|ts\|tsx\)$' | sed 's#apps/dashboard/##')
echo "$files"
echo "FILES=$files" >> $GITHUB_ENV
- name: Run ESLint on changed files
run: cd apps/dashboard && pnpm run ci-eslint-check -- ${{ env.FILES }}
- name: Run Prettier on changed files
run: cd apps/dashboard && pnpm run ci-prettier-check -- ${{ env.FILES }}