Skip to content

.github/workflows/Synchronize_CSV_and_DB.yml #128

.github/workflows/Synchronize_CSV_and_DB.yml

.github/workflows/Synchronize_CSV_and_DB.yml #128

name: Synchronize CSV and Database
on:
workflow_run:
workflows: ["Update Database with SEC Data (CIK, Ticker, Exchange, Company Name)"]
types:
- completed
workflow_dispatch: # Allows manual triggering
jobs:
sync_data:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
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.x'
- name: Install Python Dependencies
run: |
pip install pandas
- name: Synchronize CSV and Database
run: |
python 'src/scripts/Database-Sync/synchronize_csv_and_db.py'
- name: Commit and Push Database Files
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add 'data/Issuers/Main_Database.db' 'data/Issuers/Main_Database.json' 'data/Issuers/Main-Database-CSV-Files'
git commit -m "Synchronized database with CSV files" -a || echo "No changes to commit."
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}