-
Notifications
You must be signed in to change notification settings - Fork 24
51 lines (43 loc) · 1.55 KB
/
code-style.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
name: Code Style
on:
pull_request:
branches: ['main']
jobs:
code-style:
runs-on: ubuntu-latest
name: code-style
steps:
- name: Code Checkout
uses: actions/checkout@v3
- name: Setup deps
uses: ./.github/actions/install-deps
- name: Get all changed files
id: all-changed-files
uses: tj-actions/changed-files@v41
with:
files: |
!pnpm-lock.yaml
- name: Run prettier in all files
if: steps.all-changed-files.outputs.any_changed == 'true'
env:
files: ${{ steps.all-changed-files.outputs.all_changed_files }}
run: pnpm exec prettier $files --check --ignore-unknown
- name: Get specific changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files_yaml: |
code:
- '**.js'
- '**.ts'
- name: Run eslint in code files
if: steps.changed-files.outputs.code_any_changed == 'true'
env:
files: ${{ steps.changed-files.outputs.code_all_changed_files }}
run: pnpm exec eslint $files --report-unused-disable-directives --max-warnings 0 --output-file eslint_report.json --format json
- name: Annotate Code Linting Results
if: ${{ always() && !github.event.pull_request.head.repo.fork && steps.changed-files.outputs.code_any_changed == 'true' }}
uses: ataylorme/eslint-annotate-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
report-json: 'eslint_report.json'