Scrape latest data #47427
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Scrape latest data | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '*/5 * * * *' | |
jobs: | |
scrape: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Prepare the | |
- name: Check out this repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# Step 2: Get the latest data and store it as a CSV | |
- name: Fetch latest data | |
run: |- | |
curl "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv" -o usgs_current.csv | |
# Step 3: Install requirements, so Python script can run | |
- name: Install requirements | |
run: python -m pip install pandas | |
# Step 4 | |
- name: Run script to create main csv | |
run: python get_all_data.py | |
# Step 5 | |
- name: Commit and push | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
git push |