forked from Joanna-Khek/hdb_resale_prices
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (44 loc) · 1.28 KB
/
etl.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
name: Auto-update
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
- name: Install dependencies
uses: ./.github/actions/setup-python-poetry
with:
python-version: "3.12"
poetry-version: "1.8.3"
poetry-install-args: --without dev
- name: Run ETL Process
id: etl
run: |
source .venv/bin/activate
python webapp/update/etl.py
- name: Check for changes in data/*.csv
id: check_changes
run: |
changes=$(git diff --name-only | grep '^data/.*\.csv$') || true
untracked=$(git ls-files --others --exclude-standard | grep '^data/.*\.csv$') || true
if [ -n "$changes" ] || [ -n "$untracked" ]; then
echo "has_changes=true" >> $GITHUB_ENV
else
echo "has_changes=false" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.has_changes == 'true'
run: |
git config user.name 'GitHub Actions'
git config user.email '[email protected]'
echo $(date +%s) > data/metadata
git add data
git commit -m "chore: update data"
git status
git push