Update CSV and Open PR #6514
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 and Open PR | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
schedule: | |
# Run every day at 5 AM UTC | |
- cron: '10 * * * *' | |
workflow_dispatch: | |
jobs: | |
update_csv: | |
runs-on: ubuntu-latest | |
steps: | |
# Setup Python environment | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pandas requests | |
# Run the script | |
- name: Execute update script | |
env: | |
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }} | |
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }} | |
IMAP_URL: ${{ secrets.IMAP_URL }} | |
run: python scripts/update_csv.py | |
# Commit changes if any and create a new branch | |
- name: Commit and Push Changes | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git checkout -B scheduled-update | |
git add sources/huckleberry/events.csv | |
git commit -m "Update CSV $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes to commit" | |
git push -u origin scheduled-update --force | |
- name: Merge to Main Branch | |
run: | | |
git fetch origin | |
git checkout main | |
git merge scheduled-update --no-ff -m "Merge scheduled update into main" | |
git push origin main |