dev
yaml 49 lines 1.44 KB
Raw
1 name: No restricted imports in lib directory
2
3 on: [pull_request]
4
5 jobs:
6 check_restricted_imports:
7 runs-on: ubuntu-24.04
8
9 steps:
10 - uses: actions/checkout@v4
11 - name: Check for restricted imports in lib directory
12 if: github.event_name == 'pull_request'
13 run: |
14 RESTRICTED_PACKAGES=(
15 "cw_bitcoin"
16 "cw_bitcoin_cash"
17 "cw_ethereum"
18 "cw_evm"
19 "cw_haven"
20 "cw_mweb"
21 "cw_nano"
22 "cw_polygon"
23 "cw_base"
24 "cw_arbitrum"
25 "cw_solana"
26 "cw_tron"
27 "cw_wownero"
28 "cw_zano"
29 )
30
31 FOUND_RESTRICTED=false
32
33 for package in "${RESTRICTED_PACKAGES[@]}"; do
34 GREP_RESULT=$(find lib -type f -name "*.dart" -exec grep -l "import.*package:$package" {} \; || true)
35
36 if [ -n "$GREP_RESULT" ]; then
37 echo "Found restricted import of '$package' in the following files:"
38 echo "$GREP_RESULT"
39 FOUND_RESTRICTED=true
40 fi
41 done
42
43 if [ "$FOUND_RESTRICTED" = true ]; then
44 echo "Error: Restricted package imports found in lib/ directory"
45 echo "Please remove these imports as they are not allowed in the lib/ directory"
46 exit 1
47 else
48 echo "No restricted imports found. All good!"
49 fi