-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (46 loc) · 1.48 KB
/
update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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