-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
62 lines (56 loc) · 1.88 KB
/
action.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
name: 'JSTS Quality'
description: 'This action runs ESLint + Reviewdog 🐶 and Prettier.'
inputs:
github_token:
description: 'The Github API token needed for Reviewdog and checks.'
required: true
working_directory:
description: Where is your package.json and therefore your node_modules located.
required: false
default: ''
prettier_target:
description: 'Where should Prettier look?'
required: false
default: './**/*'
eslint_target:
description: 'Where should ESLint look?'
required: false
default: '.'
file_extensions:
description: 'Which file extensions should be considered.'
required: false
default: '.js,.jsx,.ts,.tsx,.mjs'
runs:
using: 'composite'
steps:
- name: Install Reviewdog
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ inputs.github_token }}
- name: ESLint
shell: bash
run: |
# Disable pipefail so it's the last command in a pipe that
# determines the overall exit code and not the first failing.
set +o pipefail
# Try running the eslint command, so we'll fail if it can't run.
npm exec -- eslint --version
npm exec -- eslint \
--format checkstyle \
--no-error-on-unmatched-pattern \
--ext ${{inputs.file_extensions}} \
${{inputs.eslint_target}} \
| reviewdog -f=checkstyle -name="eslint" -reporter=github-pr-check
working-directory: ${{ inputs.working_directory }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ inputs.github_token }}
- name: Prettier
shell: bash
run: |
npm exec -- prettier --no-error-on-unmatched-pattern --check "${{ inputs.prettier_target }}{${{ inputs.file_extensions }}}"
working-directory: ${{ inputs.working_directory }}
branding:
icon: 'terminal'
color: 'gray-dark'