Skip to content

Fetch data

Fetch data #1084

Workflow file for this run

name: Fetch data
on:
workflow_dispatch:
schedule:
- cron: '59 8 * * *'
jobs:
fetch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Setup dependencies
run: |
pip install -r requirements.txt
npm install
- name: Get data
run: |
input_directory="script/venues"
output_directory="src/data/venues"
for input_file in ${input_directory}/*.py; do
venue_name=$(basename "$input_file" .py)
output_file="${output_directory}/${venue_name}.json"
if python "$input_file" > "$output_file" 2>/dev/null; then
echo "✅ ${venue_name}.json"
else
echo "❌ ${venue_name}.json (error - skipping)"
# Remove the failed output file if it was created
rm -f "$output_file"
fi
done
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 🤖 update data
branch: ${{ github.head_ref }}