-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.29 KB
/
precheck.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Taken from obytes' react native template: https://github.com/obytes/react-native-template-obytes
name: Precheck
on:
pull_request:
branches: [main]
workflow_call:
jobs:
install:
name: Prepare enviroment + Cache
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout project repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Setup Node + PNPM + install deps
uses: ./.github/actions/setup-node-pnpm-install
lint:
name: Lint TS (eslint, prettier)
needs: [install]
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout project repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Setup Node + PNPM + install deps
uses: ./.github/actions/setup-node-pnpm-install
- name: 🏃♂️ Run ESLint PR
if: github.event_name == 'pull_request'
uses: reviewdog/action-eslint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
eslint_flags: "src --max-warnings=0"
- name: 🏃♂️ Run ESLint PR
if: github.event_name != 'pull_request'
run: pnpm run lint
type-check:
name: Check
needs: [install]
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout project repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 📦 Setup Node + PNPM + install deps
uses: ./.github/actions/setup-node-pnpm-install
- name: 📦 Install Reviewdog
if: github.event_name == 'pull_request'
uses: reviewdog/action-setup@v1
- name: 🏃♂️ Run TypeScript PR # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
# We only need to add the reviewdog step if it's a pull request
if: github.event_name == 'pull_request'
run: |
pnpm type-check | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name:
🏃♂️ Run TypeScript Commit
# If it's not a Pull Request then we just need to run the type-check
if: github.event_name != 'pull_request'
run: pnpm type-check