@samitouri / QOS-React / commits / f598eb4dc9

[ci] Add new lint GitHub action

Copies the existing circleci workflow for linting into GitHub actions. I didn't remove the circleci for now just to check for parity. ghstack-source-id: a3754dcc3bdf1b3fa7b8ca73b1554ef9fc9265b1 Pull Request resolved: https://github.com/facebook/react/pull/30023

Lauren Tan committed Jun 21, 2024 at 11:41 UTC f598eb4dc9d40d5983e825b374ce4cd34096db25
1 file changed +79
.github/workflows/lint.yml new
+79
@@ -0,0 +1,79 @@
1 +name: Lint
2 +
3 +on:
4 + push:
5 + branches: [main]
6 + pull_request:
7 +
8 +jobs:
9 + prettier:
10 + name: Run prettier
11 + runs-on: ubuntu-latest
12 + steps:
13 + - uses: actions/checkout@v4
14 + - uses: actions/setup-node@v4
15 + with:
16 + node-version: 18.x
17 + cache: "yarn"
18 + cache-dependency-path: yarn.lock
19 + - name: Restore cached node_modules
20 + uses: actions/cache@v4
21 + with:
22 + path: "**/node_modules"
23 + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
24 + - run: yarn install --frozen-lockfile
25 + - run: yarn prettier-check
26 +
27 + eslint:
28 + name: Run eslint
29 + runs-on: ubuntu-latest
30 + steps:
31 + - uses: actions/checkout@v4
32 + - uses: actions/setup-node@v4
33 + with:
34 + node-version: 18.x
35 + cache: "yarn"
36 + cache-dependency-path: yarn.lock
37 + - name: Restore cached node_modules
38 + uses: actions/cache@v4
39 + with:
40 + path: "**/node_modules"
41 + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
42 + - run: yarn install --frozen-lockfile
43 + - run: node ./scripts/tasks/eslint
44 +
45 + check_license:
46 + name: Check license
47 + runs-on: ubuntu-latest
48 + steps:
49 + - uses: actions/checkout@v4
50 + - uses: actions/setup-node@v4
51 + with:
52 + node-version: 18.x
53 + cache: "yarn"
54 + cache-dependency-path: yarn.lock
55 + - name: Restore cached node_modules
56 + uses: actions/cache@v4
57 + with:
58 + path: "**/node_modules"
59 + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
60 + - run: yarn install --frozen-lockfile
61 + - run: ./scripts/circleci/check_license.sh
62 +
63 + test_print_warnings:
64 + name: Test print warnings
65 + runs-on: ubuntu-latest
66 + steps:
67 + - uses: actions/checkout@v4
68 + - uses: actions/setup-node@v4
69 + with:
70 + node-version: 18.x
71 + cache: "yarn"
72 + cache-dependency-path: yarn.lock
73 + - name: Restore cached node_modules
74 + uses: actions/cache@v4
75 + with:
76 + path: "**/node_modules"
77 + key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
78 + - run: yarn install --frozen-lockfile
79 + - run: ./scripts/circleci/test_print_warnings.sh