forked from tj-actions/eslint-changed-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
105 lines (103 loc) · 4.01 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
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
name: ESLint changed files
description: Run ESLint on all changed files
author: jackton1
inputs:
token:
description: '[GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) or a repo scoped [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)'
required: true
default: ${{ github.token }}
all_files:
description: 'Run [ESlint](https://eslint.org/) on all matching files'
required: false
default: false
config_path:
description: '[ESlint](https://eslint.org/) [configuration file](https://eslint.org/docs/user-guide/configuring/). Optionally omit this input for Mono repositories.'
required: false
default: ''
ignore_path:
description: '[ESlint](https://eslint.org/) [ignore file](https://eslint.org/docs/user-guide/configuring/ignoring-code)'
required: false
default: ''
file_extensions:
description: List of file extensions to watch for changes and run [ESlint](https://eslint.org/) against
required: false
default: |
**/*.ts
**/*.tsx
**/*.js
**/*.jsx
extra_args:
description: Extra arguments passed to [ESlint](https://eslint.org/docs/user-guide/command-line-interface)
required: false
default: ''
skip_annotations:
description: Skip running reviewdog i.e don't add any annotations.
required: false
default: 'false'
level:
description: 'Report level for reviewdog [info,warning,error]'
required: false
default: 'error'
reporter:
description: |
[Reporter](https://github.com/reviewdog/reviewdog#reporters) of reviewdog command [github-check,github-pr-review].
github-pr-review can use Markdown and add a link to rule page in reviewdog reports.
required: false
default: 'github-pr-review'
filter_mode:
description: |
[Filter mode](https://github.com/reviewdog/reviewdog#filter-mode) for the reviewdog command [added,diff_context,file,nofilter].
required: false
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false].
required: false
default: 'true'
path:
description: 'Relative path under GITHUB_WORKSPACE to the repository'
required: false
default: '.'
runs:
using: 'composite'
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.14.1
- name: Get changed files
id: changed-files
uses: airbase/gh-action-changed-files@main
with:
path: ${{ inputs.path }}
files: ${{ inputs.file_extensions }}
files_ignore_from_source_file: ${{ inputs.ignore_path }}
diff_relative: true
- name: Run eslint on changed files
run: |
# Run eslint on changed files
bash $GITHUB_ACTION_PATH/entrypoint.sh
id: eslint-changed-files
shell: bash -ileo pipefail {0}
env:
GITHUB_SERVER_URL: ${{ github.server_url }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_SHA: ${{ github.sha }}
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_TOKEN: ${{ inputs.token }}
INPUT_PATH: ${{ inputs.path }}
INPUT_LEVEL: ${{ inputs.level }}
INPUT_ALL_FILES: ${{ inputs.all_files }}
INPUT_CONFIG_PATH: ${{ inputs.config_path }}
INPUT_IGNORE_PATH: ${{ inputs.ignore_path }}
INPUT_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
INPUT_EXTRA_ARGS: ${{ inputs.extra_args }}
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_REPORTER: ${{ inputs.reporter }}
INPUT_SKIP_ANNOTATIONS: ${{ inputs.skip_annotations }}
branding:
icon: check-square
color: white