-
Notifications
You must be signed in to change notification settings - Fork 26
216 lines (207 loc) · 7.59 KB
/
linter.yaml
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Lint
on:
workflow_dispatch: { }
push:
pull_request:
types: [ opened, edited, synchronize, reopened ]
jobs:
common-check:
name: Common checks
uses: ./.github/workflows/common_check.yaml
with:
run_trigger: ${{ github.event_name }}
# super-linter:
# name: Super Lint Code Base
# needs: common-check
# runs-on: ubuntu-22.04
# if: needs.common-check.outputs.continue == 'true'
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# with:
# # Full git history is needed to get a proper list of changed files within `super-linter`
# fetch-depth: 0
# - name: Lint Code Base
# uses: github/[email protected]
# env:
# DISABLE_ERRORS: true
# DEFAULT_BRANCH: master
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# MULTI_STATUS: true
# LOG_LEVEL: WARN
# ERROR_ON_MISSING_EXEC_BIT: true
# SUPPRESS_FILE_TYPE_WARN: false
# JSCPD_CONFIG_FILE: .jscpd.json
# NATURAL_LANGUAGE_CONFIG_FILE: .textlintrc
# JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
# TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.json
# VALIDATE_ALL_CODEBASE: false
# IGNORE_GITIGNORED_FILES: true
# VALIDATE_BASH: true
# VALIDATE_BASH_EXEC: true
# VALIDATE_CPP: true
# VALIDATE_CLANG_FORMAT: true
# VALIDATE_CLOUDFORMATION: true
# VALIDATE_CSS: true
# VALIDATE_DART: true
# VALIDATE_DOCKERFILE_HADOLINT: true
# VALIDATE_EDITORCONFIG: true
# VALIDATE_GITHUB_ACTIONS: true
# VALIDATE_GITLEAKS: true
# VALIDATE_GOOGLE_JAVA_FORMAT: true
# VALIDATE_HTML: true
# VALIDATE_JAVA: true
# VALIDATE_JAVASCRIPT_ES: true
# VALIDATE_JSON: true
# VALIDATE_JSX: true
# VALIDATE_KUBERNETES_KUBEVAL: true
# VALIDATE_LUA: true
# VALIDATE_NATURAL_LANGUAGE: true
# VALIDATE_POWERSHELL: true
# VALIDATE_SHELL_SHFMT: true
# VALIDATE_TERRAFORM_TERRASCAN: true
# VALIDATE_TERRAFORM_TFLINT: true
# VALIDATE_TSX: true
# VALIDATE_TYPESCRIPT_ES: true
# VALIDATE_XML: true
# VALIDATE_YAML: true
markdown:
name: MarkdownLint
needs: common-check
runs-on: ubuntu-22.04
if: needs.common-check.outputs.continue == 'true'
permissions:
pull-requests: read
steps:
- name: Set git fetch depth
run: |
if [[ ${{ github.event_name }} != 'pull_request' ]]; then
echo "FETCH_DEPTH=2" >> "$GITHUB_ENV"
else
echo "FETCH_DEPTH=0" >> "$GITHUB_ENV"
fi
- uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- uses: tj-actions/changed-files@v42
id: changed-files
with:
files: '**/*.{md,mdx}'
separator: ","
- uses: DavidAnson/[email protected]
if: steps.changed-files.outputs.any_changed == 'true'
with:
globs: ${{ steps.changed-files.outputs.all_changed_files }}
separator: ","
fix: true
commit:
name: CommitLint
needs: common-check
runs-on: ubuntu-22.04
if: needs.common-check.outputs.continue == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install commitlint dependencies
run: npm install --location=global @commitlint/config-conventional @commitlint/cli
- uses: wagoid/commitlint-github-action@v5
with:
configFile: commitlint.config.js
failOnWarnings: false
helpURL: https://datagrok.ai/help/develop/dev-process/git-policy#commit-message-policy
pr-name:
name: PR name
runs-on: ubuntu-22.04
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v4
with:
node-version: '18'
# https://github.com/JulienKode/pull-request-name-linter-action/issues/236
- name: Install commitlint dependencies
run: npm install @commitlint/config-conventional@v17 @commitlint/cli
- name: Commitlint PR title
uses: JulienKode/[email protected]
with:
configuration-path: ./commitlint.config.js
packages-links:
name: Packages links
runs-on: ubuntu-22.04
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check links in packages
shell: bash
continue-on-error: true
timeout-minutes: 15
id: test-links
run: |
test_result=$(./packages_help.sh)
if [ -z "$test_result" ]; then
echo "All tests finished successfully"
else
echo -e "${test_result}"
echo -e "SLACK_MESSAGE_BODY=${test_result}\n\n" | sed -e '$ ! s/$/\\n/' | tr -d '\n' >> $GITHUB_ENV
exit 1
fi
working-directory: packages/
- name: Prepare Slack Message
id: slack-prepare
if: ${{ steps.test-links.outcome == 'failure' }}
shell: bash
env:
SLACK_ID: ${{ secrets.SLACK_ID }}
run: |
channel_id=$(echo "$SLACK_ID" | jq -r .\"${{ github.actor }}\")
echo "::add-mask::$channel_id"
echo SLACK_CHANNEL=$channel_id >> $GITHUB_ENV
header="GitHub <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} ${{ github.run_number }}> found dangling help links in packages:"
echo SLACK_MESSAGE_HEADER=$header >> $GITHUB_ENV
context="*Branch:* <${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|$(echo ${{ github.sha }} | cut -c1-8) $(git log --format=%B -n 1 ${{ github.sha }} | head -n1)>"
echo SLACK_MESSAGE_CONTEXT=$context >> $GITHUB_ENV
echo -e "SLACK_MESSAGE_BODY=${SLACK_MESSAGE_BODY}" | sed -e '$ ! s/$/\\n/' -e 's/"/\\"/g' | tr -d '\n' >> $GITHUB_ENV
- name: Send test report to Slack
id: slack
if: ${{ steps.slack-prepare.outcome == 'success' }}
uses: slackapi/[email protected]
with:
channel-id: ${{ env.SLACK_CHANNEL }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.SLACK_MESSAGE_HEADER }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.SLACK_MESSAGE_BODY }}"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "${{ env.SLACK_MESSAGE_CONTEXT }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACKBOT_TOKEN }}