forked from tsuyoshicho/action-mypy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
140 lines (137 loc) · 4.83 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
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
name: 'Run mypy with reviewdog'
description: '🐶 Run mypy with reviewdog on pull requests to improve code review experience.'
author: 'Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com>'
inputs:
github_token:
description: 'GITHUB_TOKEN'
required: false
default: '${{ github.token }}'
workdir:
description: |
Working directory of where to run mypy command.
Relative to the root directory.
required: false
default: '.'
target:
description: |
Target files and/or directories of mypy command.
Enumerate in a space-separated list.
Relative to the working directory.
required: false
default: '.'
### Flags for setup/execute ###
execute_command:
description: |
mypy execute command.
Normally it is "mypy", but for example "poetry run mypy"
if you want to run at Poetry without activating the virtual environment.
required: false
default: 'mypy'
setup_command:
description: |
mypy setup command.
Runs when "setup_method" is "install" or required by "adaptive".
If you want to fix the version of mypy, set the value as in the following example.
"pip install mypy==1.6.0"
required: false
default: 'pip install mypy'
setup_method:
description: |
mypy setup method. Select from below.
"nothing" - no setup process.
This option expects the user to prepare the environment
(ex. previous workflow step executed "pip install -r requirements.txt").
If you do not want immediately package installation (e.g., in a poetry environment), must be this.
"adaptive" - Check "execute_command" with "--version" is executable.
If it can be executed, do the same as "nothing", otherwise do the same as "install".
"install" - execute "setup_command".
Incorrect values behave as "adaptive".
required: false
default: 'nothing'
install_types:
description: |
Pre-run mypy and check for missing stubs.
Then perform stub installation.
(ex. ${execute_command} --install-types)
required: false
default: 'true'
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
required: false
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
required: false
default: 'github-pr-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
required: false
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
required: false
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
required: false
default: ''
### Flags for mypy ###
mypy_flags:
description: 'mypy options (default: <none>)'
required: false
default: ''
tool_name:
description: 'Tool name to use for reviewdog reporter'
default: 'mypy'
ignore_note:
description: |
Currently, this option is always true.
Ignore "note: entries" that as reported by mypy.
Old description:
Ignore note entry.
mypy report some error with optional note entry.
This option is workaround.
required: false
default: 'true'
output_json:
description: |
Use the JSON output format available in mypy 1.11 or higher.
This option defaults to false due to version limitations
and because it is still experimental.
Note the mypy version when setting to true.
required: false
default: 'false'
runs:
using: 'composite'
steps:
- run: $GITHUB_ACTION_PATH/script.sh
shell: sh
env:
REVIEWDOG_VERSION: v0.20.2
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.saobby.my.eu.orgmunity/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_WORKDIR: ${{ inputs.workdir }}
INPUT_TARGET: ${{ inputs.target }}
INPUT_EXECUTE_COMMAND: ${{ inputs.execute_command }}
INPUT_SETUP_COMMAND: ${{ inputs.setup_command }}
INPUT_SETUP_METHOD: ${{ inputs.setup_method }}
INPUT_LEVEL: ${{ inputs.level }}
INPUT_REPORTER: ${{ inputs.reporter }}
INPUT_FILTER_MODE: ${{ inputs.filter_mode }}
INPUT_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}
INPUT_MYPY_FLAGS: ${{ inputs.mypy_flags }}
INPUT_TOOL_NAME: ${{ inputs.tool_name }}
# INPUT_IGNORE_NOTE: ${{ inputs.ignore_note }}
INPUT_INSTALL_TYPES: ${{ inputs.install_types }}
INPUT_OUTPUT_JSON: ${{ inputs.output_json }}
# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
icon: 'check'
color: 'green'