-
Notifications
You must be signed in to change notification settings - Fork 43
57 lines (49 loc) · 1.81 KB
/
solhint.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
# A Github Actions config to run Solhint and report the artifact to DeepSource
name: Solhint Analysis for Solidity
on:
# Note that both `push` and `pull_request` triggers should be present for GitHub to consistently present solhint
# SARIF reports.
push:
branches: [main, master]
pull_request:
jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v4
with:
node-version: "16"
cache: npm
cache-dependency-path: "solidity/package-lock.json"
- name: Install solhint
run: |
npm install solhint@^4.1.1
- name: Run solhint
id: solhint
run: |
cd solidity
npx solhint '*.sol' -f sarif > solhint.sarif
# The following line prevents aborting the workflow immediately in case your files fail solhint checks.
# This allows the following upload-sarif action to still upload the results.
continue-on-error: true
- name: Upload SARIF report files to DeepSource
id: upload-sarif
run: |
# Install the CLI
curl https://deepsource.io/cli | sh
# Send the report to DeepSource
./bin/deepsource report --analyzer solhint --analyzer-type community --value-file solidity/solhint.sarif
# Ensure the workflow eventually fails if files did not pass solhint checks.
- name: Verify solhint succeeded
shell: bash
run: |
echo "If this step fails, solhint found issues. Check the output of the scan step above."
[[ "${{ steps.solhint.outcome }}" == "success" ]]