-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
48 lines (48 loc) · 1.51 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
name: 'Lint with lintrunner'
description: 'Lint the repository with lintrunner'
branding:
icon: check-circle
color: yellow
inputs:
publish_code_scanning:
description: 'Whether to publish the sarif files to GitHub'
required: false
default: true
quiet:
description: 'Turn off verbose logging in lintrunner'
required: false
default: false
runs:
using: "composite"
steps:
- name: Install lintrunner and lintrunner-adapters
shell: bash
run: |
pip install --quiet lintrunner lintrunner-adapters
- name: Lintrunner init
shell: bash
run: |
lintrunner init
- name: Run lintrunner on all files
shell: bash
run: |
set +e
if ! lintrunner ${{ inputs.quiet == 'true' && ' ' || '-v' }} --force-color --all-files --tee-json=lint.json; then
echo ""
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`.\e[0m"
exit 1
fi
- name: Produce SARIF
if: always() && inputs.publish_code_scanning == 'true'
shell: bash
run: |
python -m lintrunner_adapters to-sarif lint.json lintrunner.sarif
- name: Upload SARIF file
if: always() && inputs.publish_code_scanning == 'true'
continue-on-error: true
uses: github/codeql-action/upload-sarif@v3
with:
# Path to SARIF file relative to the root of the repository
sarif_file: lintrunner.sarif
category: lintrunner
checkout_path: ${{ github.workspace }}