Skip to content

Commit 8bd440e

Browse files
authored
feat: savant.chat integration (#167)
* feat: savant.chat integration * feat: Add SAVANT_NOTIFICATION_CONTACTS and missing docs to savant action
1 parent 54221b8 commit 8bd440e

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Savant Smart Contract Analyzer
2+
#
3+
# Required secrets:
4+
# - SAVANT_API_TOKEN: API token for Savant.Chat (get from https://savant.chat -> Profile -> Settings -> API Keys)
5+
#
6+
# Optional secrets:
7+
# - SAVANT_NOTIFICATION_CONTACTS: Default notification contacts (comma-separated emails, Telegram usernames, or chat IDs)
8+
# These contacts will always receive notifications, regardless of trigger type.
9+
# Example: 'devops@company.com, @telegram_devops, 123456789'
10+
#
11+
on:
12+
# Manual trigger with inputs
13+
workflow_dispatch:
14+
inputs:
15+
base_commit:
16+
description: 'Base commit SHA for comparison'
17+
required: true
18+
head_commit:
19+
description: 'Head commit SHA for comparison'
20+
required: true
21+
default: 'HEAD'
22+
dry_run:
23+
description: 'Dry run mode'
24+
required: false
25+
default: 'false'
26+
type: boolean
27+
tier:
28+
description: 'Audit tier'
29+
required: false
30+
default: 'pro'
31+
type: choice
32+
options:
33+
- pro
34+
- advanced
35+
- lite
36+
notification_contacts:
37+
description: 'Additional notification contacts (comma-separated emails and Telegram usernames). Will be combined with SAVANT_NOTIFICATION_CONTACTS secret if set.'
38+
required: false
39+
default: ''
40+
41+
# Automatically trigger on pull requests
42+
# pull_request:
43+
# branches:
44+
# - master
45+
# - main
46+
47+
# Trigger on push to specified branches
48+
# push:
49+
# branches:
50+
# - master
51+
# - main
52+
53+
jobs:
54+
analyze:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v3
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Combine notification contacts
63+
id: notification_contacts
64+
shell: bash
65+
run: |
66+
SECRET_CONTACTS="${{ secrets.SAVANT_NOTIFICATION_CONTACTS }}"
67+
INPUT_CONTACTS="${{ github.event_name == 'workflow_dispatch' && github.event.inputs.notification_contacts || '' }}"
68+
69+
# Combine contacts if both exist, otherwise use whichever is available
70+
if [ -n "$SECRET_CONTACTS" ] && [ -n "$INPUT_CONTACTS" ]; then
71+
COMBINED_CONTACTS="${SECRET_CONTACTS}, ${INPUT_CONTACTS}"
72+
elif [ -n "$SECRET_CONTACTS" ]; then
73+
COMBINED_CONTACTS="$SECRET_CONTACTS"
74+
elif [ -n "$INPUT_CONTACTS" ]; then
75+
COMBINED_CONTACTS="$INPUT_CONTACTS"
76+
else
77+
COMBINED_CONTACTS=""
78+
fi
79+
80+
echo "contacts=$COMBINED_CONTACTS" >> $GITHUB_OUTPUT
81+
echo "Combined notification contacts: $COMBINED_CONTACTS"
82+
83+
- name: Create Savant.Chat audit request
84+
uses: auditdbio/savant-smart-contract-analyzer@v1.4
85+
with:
86+
base_commit: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.base_commit || github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }}
87+
head_commit: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.head_commit || github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
88+
api_token: ${{ secrets.SAVANT_API_TOKEN }}
89+
dry_run: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run || 'false' }}
90+
tier: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tier || 'advanced' }}
91+
notification_contacts: ${{ steps.notification_contacts.outputs.contacts }}
92+

.savantdocs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .savantdocs — file and directory patterns and documentation links
2+
#
3+
# Syntax:
4+
# - Blank lines and lines starting with '#' are comments and ignored.
5+
# - Include patterns (no leading '!') specify files/directories or external URLs to include as documentation.
6+
# - Exclude patterns (leading '!') remove matching entries from the documentation scan.
7+
# - Glob patterns follow .gitignore-style ("**" for any directories).
8+
# - URLs (http:// or https://) are allowed and treated as documentation links.
9+
#
10+
11+
# Include specs documentation
12+
specs/**/*.md
13+
specs/**/*.txt
14+
specs/**/*.pdf
15+
https://docs.balancer.fi/developer-reference/contracts/router-api.html
16+
17+
# Exclude dependency documentation
18+
!node_modules/**/*
19+
!lib/**/*
20+

.savantscope

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# .savantscope — file and directory patterns for scanning Solidity files
2+
#
3+
# Syntax:
4+
# - Blank lines and lines starting with '#' are comments and ignored.
5+
# - Include patterns (no leading '!') specify files/directories to scan.
6+
# - Exclude patterns (leading '!') remove matching files from the scan.
7+
# - Glob patterns follow .gitignore-style ("**" for any directories).
8+
#
9+
10+
# Include all contracts (only changed methods will be analyzed)
11+
contracts/**/*.sol
12+
13+
# Exclude test files and directories
14+
!contracts/test/**/*.sol
15+
!**/test/**/*.sol
16+
!**/tests/**/*.sol
17+
18+
# Exclude mock contracts
19+
!contracts/test/mocks/**/*.sol
20+
!**/mock/**/*.sol
21+
!**/mocks/**/*.sol
22+
23+
# Exclude interfaces
24+
!contracts/interfaces/**/*.sol
25+
!contracts/integrations/**/*.sol
26+
!**/interface/**/*.sol
27+
!**/interfaces/**/*.sol
28+

0 commit comments

Comments
 (0)