Sync Garmin to Notion #6718
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: Sync Garmin to Notion | |
on: | |
schedule: | |
# This cron job will run every 15 minutes from 6 AM to 11 PM Eastern Time | |
- cron: '*/10 10-23 * * *' # Every 15 minutes from 10:00 to 23:45 UTC | |
- cron: '*/10 0-3 * * *' # Every 15 minutes from 00:00 to 03:45 UTC | |
workflow_dispatch: | |
env: | |
TZ: 'America/Montreal' | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Cache pip packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements.txt | |
- name: Run script | |
env: | |
GARMIN_EMAIL: ${{ secrets.GARMIN_EMAIL }} | |
GARMIN_PASSWORD: ${{ secrets.GARMIN_PASSWORD }} | |
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} | |
NOTION_DB_ID: ${{ secrets.NOTION_DB_ID }} | |
NOTION_PR_DB_ID: ${{ secrets.NOTION_PR_DB_ID }} | |
TZ: 'America/Montreal' | |
run: | | |
python garmin-activities.py | |
python personal-records.py |