Skip to content

Commit 1342818

Browse files
committed
adding custom python validation
1 parent 87da07f commit 1342818

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/csvlint.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10-
- name: Install csvkit
11-
run: pip install csvkit
12-
- name: Validate CSV file with csvclean
13-
run: csvclean .shelldio/all_stations.txt
10+
- name: Validate CSV structure
11+
run: |
12+
python3 <<EOF
13+
import sys, re
14+
with open('.shelldio/all_stations.txt') as f:
15+
for i, line in enumerate(f, 1):
16+
parts = [p.strip() for p in line.strip().split(',', 1)]
17+
if len(parts) != 2 or not parts[0] or not parts[1]:
18+
print(f"Line {i} is invalid: {line.strip()}")
19+
sys.exit(1)
20+
if not re.match(r'https?://', parts[1]):
21+
print(f"Line {i} has invalid URL: {parts[1]}")
22+
sys.exit(1)
23+
EOF

0 commit comments

Comments
 (0)