Skip to content

Commit

Permalink
Create Sheets_To_SQL.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesAlfonse authored Jul 22, 2024
1 parent 6849a03 commit 2f9e332
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/Sheets_To_SQL.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Database with Google Sheets Data

on:
schedule:
# - cron: '0 0 * * *' # Runs every day at midnight
workflow_dispatch:

concurrency:
group: database-update

jobs:
update_database:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install Python Dependencies
run: |
pip install gspread oauth2client
- name: Read Google Sheet and Write to SQL Database
env:
SHEET_ID: ${{ secrets.SHEET_ID }}
GOOGLE_API_KEYS: ${{ secrets.GOOGLE_API_KEYS }}
run: |
python 'src/scripts/update_sql.py'
- name: Change Primary Key in Database
run: python src/scripts/change_primary_key_to_cik.py

- name: Commit and Push Database Files
run: |
git config --global user.name 'JamesAlfonse'
git config --global user.email '[email protected]'
git add 'data/Full_Database_Backend.db' 'data/Full_Database_Backend.json' # Add both the database and the JSON file
git commit -m "Updated database and JSON files" -a || echo "No changes to commit."
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 2f9e332

Please sign in to comment.