Update CSV #648
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: Update CSV | |
on: | |
schedule: | |
# Runs every 4 hours | |
- cron: '0 */4 * * *' | |
workflow_dispatch: # This line allows manual trigger | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install gdown | |
- name: Download CSV from Google Docs | |
run: | | |
# This assumes that your Google Docs file is publicly accessible | |
gdown "https://docs.google.com/spreadsheets/d/1NdCOLpp6u8EHpN6SpeSAwxiJYivawi0YFznZ6AN7fKk/export?format=csv" -O "bbwEvents.csv" | |
- name: Check for changes and commit | |
run: | | |
if ! diff "bbwEvents.csv" ./events.csv ; then | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
cp "bbwEvents.csv" ./events.csv | |
git add ./events.csv | |
git commit -m "Update CSV file" | |
git push | |
fi |