-
-
Notifications
You must be signed in to change notification settings - Fork 21
161 lines (139 loc) · 4.43 KB
/
test.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Test
on:
pull_request:
branches:
- main
jobs:
shellcheck:
name: Run shellcheck
runs-on: ubuntu-latest
steps:
- name: Checkout to branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: shellcheck
uses: reviewdog/[email protected]
lint:
name: Run Lint
runs-on: ubuntu-latest
steps:
- name: Checkout to branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
cache-dependency-path: test-app/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: test-app
- name: Run Stylelint
run: yarn stylelint
working-directory: test-app
- name: Run ESLint for a nested project with changed files and .eslintignore
uses: ./
with:
path: "test-app"
config_path: "eslint.config.mjs"
file_extensions: |
**/*.ts
**/*.tsx
extra_args: "--max-warnings=0"
ignore_patterns: "src/reportWebVitals.ts"
escape_paths: false
- name: Fix Lint Errors
if: failure()
run: yarn stylelint:fix
working-directory: test-app
- name: Fix ESLint errors for a nested project with changed files and .eslintignore
if: failure()
uses: ./
with:
path: "test-app"
config_path: "eslint.config.mjs"
file_extensions: |
**/*.ts
**/*.tsx
escape_paths: false
extra_args: "--fix"
skip_annotations: true
ignore_patterns: "src/reportWebVitals.ts"
- name: Verify Changed files
if: failure()
uses: tj-actions/verify-changed-files@v20
id: verify-changed-files
with:
files: |
**/*.{ts,tsx}
- name: Commit outstanding changes
if: failure() && steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add ${{ steps.verify-changed-files.outputs.changed_files }}
git commit -m "lint fixes."
- name: Push changes
if: failure() && steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT_TOKEN }}
branch: ${{ github.head_ref }}
eslint-changed-files:
runs-on: ${{ matrix.platform }}
needs:
- lint
strategy:
fail-fast: false
matrix:
platform:
- ubuntu-latest
# - windows-latest
- macos-latest
fetch-depth: [0, 1]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
cache-dependency-path: test-app/yarn.lock
- name: Install dependencies
run: yarn
working-directory: test-app
- name: Run ESLint on changed files
uses: ./
with:
path: "test-app"
config_path: "eslint.config.mjs"
file_extensions: |
**/*.ts
**/*.tsx
escape_paths: false
extra_args: "--max-warnings=0"
ignore_patterns: "src/reportWebVitals.ts"
- name: Run ESLint on all files
uses: ./
with:
path: "test-app"
config_path: "eslint.config.mjs"
file_extensions: |
**/*.ts
**/*.tsx
extra_args: "--max-warnings=0"
all_files: true
- name: Run ESLint on all files without a config_path on all files
uses: ./
with:
path: "test-app"
file_extensions: |
**/*.ts
**/*.tsx
extra_args: "--max-warnings=0"
all_files: true