forked from yu-iskw/action-sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
181 lines (178 loc) · 7.18 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: 'Run sqlfluff with reviewdog'
description: '🐶 Run sqlfluff with reviewdog on pull requests to improve code review experience.'
author: 'yu-iskw'
inputs:
github_token:
description: 'GITHUB_TOKEN'
required: true
default: '${{ github.token }}'
github_base_ref:
description: "Pull request target branch name"
required: false
default: "${{ github.base_ref }}"
working-directory:
description: 'working directory'
required: false
default: '${{ github.workspace }}'
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
required: false
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-check,github-pr-review].'
required: false
default: 'github-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is file.
required: false
default: 'file'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
required: false
default: 'false'
reviewdog_version:
description: 'reviewdog version'
required: false
default: 'v0.14.0'
### Flags for sqlfluff ###
sqlfluff_version:
description: |
sqlfluff version. Use the latest version if not set.
It must be 0.9.0 or later, because `sqlfluff<=0.8.2` doesn't support the `--config` option in the `fix` sub command.
required: false
default: '0.13.0'
sqlfluff_command:
description: 'The sub command of sqlfluff. One of lint and fix'
required: false
default: 'lint'
paths:
description: |
PATH is the path to a sql file or directory to lint.
This can be either a file ('path/to/file.sql'), a path ('directory/of/sql/files'), a single ('-') character to indicate reading from *stdin* or a dot/blank ('.'/' ') which will be interpreted like passing the current working directory as a path argument.
required: true
file_pattern:
description: "The regular expression to filter checked files"
required: false
default: '\.sql$'
encoding:
description: 'Specifiy encoding to use when reading and writing files. Defaults to autodetect.'
required: false
default: ''
config:
description: |
Include additional config file.
By default the config is generated from the standard configuration files described in the documentation.
This argument allows you to specify an additional configuration file that overrides the standard configuration files.
N.B. cfg format is required.
required: false
default: ''
exclude-rules:
description: |
Exclude specific rules.
For example specifying –exclude-rules L001 will remove rule L001 (Unnecessary trailing whitespace) from the set of considered rules.
This could either be the allowlist, or the general set if there is no specific allowlist.
Multiple rules can be specified with commas e.g. –exclude-rules L001,L002 will exclude violations of rule L001 and rule L002.
required: false
default: ''
rules:
description: |
Narrow the search to only specific rules.
For example specifying –rules L001 will only search for rule L001 (Unnecessary trailing whitespace).
Multiple rules can be specified with commas e.g. –rules L001,L002 will specify only looking for violations of rule L001 and rule L002.
required: false
default: ''
templater:
description: 'The templater to use'
required: false
default: ''
disable-noqa:
description: 'Set this flag to ignore inline noqa comments.'
required: false
default: ''
dialect:
description: 'The dialect of SQL to lint'
required: false
default: ''
# annotation-level:
# description: |
# When format is set to github-annotation, default annotation level.
# Options
# notice | warning | failure
# required: false
# default: ''
# nofail:
# description: |
# If set, the exit code will always be zero, regardless of violations found.
# This is potentially useful during rollout.
# required: false
# default: ''
# disregard-sqlfluffignores:
# description: 'Perform the operation regardless of .sqlfluffignore configurations'
# required: false
# default: ''
processes:
description: 'The number of parallel processes to run.'
required: false
default: "2"
# Mainly used to install dbt adapters
# NOTE:
# sqlfluff tries to dynamically import a dbt adapter based on a configuration.
# There is no great way to dynamically install required dbt adapters to fit to users of action.
# It might be possible to support only dbt adapters craeted by dbt labo.
# But, as that doesn't support 3rd party dbt adapters, we have no choise but for users to pass their custom extra requirements.txt.
extra_requirements_txt:
description: |
A path to your custom `requirements.txt` to install extra modules for your dbt adapters.
Please make sure not to contain `sqlfluff` and its dependent packages, because the action can be broken by the conflicts.
required: false
default: ''
outputs:
sqlfluff-results:
description: 'The JSON object string of sqlfluff results'
value: ${{ steps.sqlfluff-with-reviewdog-in-composite.outputs.sqlfluff-results }}
sqlfluff-exit-code:
description: 'The exit code of sqlfluff'
value: ${{ steps.sqlfluff-with-reviewdog-in-composite.outputs.sqlfluff-exit-code }}
sqlfluff-results-rdjson:
description: 'The JSON object string of sqlfluff results'
value: ${{ steps.sqlfluff-with-reviewdog-in-composite.outputs.sqlfluff-results-rdjson }}
reviewdog-return-code:
description: 'The exit code of reviewdog'
value: ${{ steps.sqlfluff-with-reviewdog-in-composite.outputs.reviewdog-return-code }}
runs:
using: 'docker'
image: 'Dockerfile'
env:
# 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_GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_WORKING_DIRECTORY: ${{ inputs.working-directory }}
REVIEWDOG_LEVEL: ${{ inputs.level }}
REVIEWDOG_REPORTER: ${{ inputs.reporter }}
REVIEWDOG_FILTER_MODE: ${{ inputs.filter_mode }}
REVIEWDOG_FAIL_ON_ERROR: ${{ inputs.fail_on_error }}
REVIEWDOG_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}
REVIEWDOG_ESLINT_FLAGS: ${{ inputs.eslint_flags }}
REVIEWDOG_TOOL_NAME: ${{ inputs.tool_name }}
EXTRA_REQUIREMENTS_TXT: ${{ inputs.extra_requirements_txt }}
SQLFLUFF_VERSION: ${{ inputs.sqlfluff_version }}
SQLFLUFF_COMMAND: ${{ inputs.sqlfluff_command }}
SQLFLUFF_CONFIG: ${{ inputs.config }}
SQLFLUFF_PATHS: ${{ inputs.paths }}
SQLFLUFF_PROCESSES: ${{ inputs.processes }}
SQLFLUFF_EXCLUDE_RULES: ${{ inputs.exclude-rules }}
SQLFLUFF_RULES: ${{ inputs.rules }}
SQLFLUFF_TEMPLATER: ${{ inputs.templater }}
SQLFLUFF_DISABLE_NOQA: ${{ inputs.disable-noqa }}
SQLFLUFF_DIALECT: ${{ inputs.dialect }}
GITHUB_PULL_REQUEST_BASE_REF: ${{ inputs.github_base_ref }}
FILE_PATTERN: ${{ inputs.file_pattern }}
# Ref: https://haya14busa.github.io/github-action-brandings/
branding:
icon: 'check'
color: 'blue'