-
-
Notifications
You must be signed in to change notification settings - Fork 69
49 lines (39 loc) · 1.09 KB
/
release-new-data.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
49
name: Convert CSV to JSON for Database updates and release to Azure DB
on:
push:
paths:
- 'db/**'
branches:
- main
pull_request:
paths:
- 'db/**'
jobs:
convert:
runs-on: ubuntu-latest
steps:
# Checkout project
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pandas
run: pip install pandas
- name: Convert CSV to JSON
run: |
import os
import pandas as pd
os.makedirs('db/json', exist_ok=True)
csv_files = [f for f in os.listdir('db/csv') if f.endswith('.csv')]
for file in csv_files:
df = pd.read_csv(f'db/csv/{file}')
json_path = f'db/json/{file.replace(".csv", ".json")}'
df.to_json(json_path, orient='records', lines=True)
print("Conversion complete.")
- name: Upload JSON files as artifacts
uses: actions/upload-artifact@v4
with:
name: json-files
path: db/json/