Reminders #11
This file contains hidden or 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: Reminders | |
on: | |
schedule: | |
# Runs every 2 hours from 12 PM to 8 PM (Beijing time, UTC+8) from Wednesday to Friday. | |
# Converted to UTC, 12 PM to 8 PM UTC is 4 AM to 12 PM UTC. | |
# Minute 0, Hours 4, 6, 8, 10, 12 (UTC), Any day of month, Any month, Days of week 3-5 (Wednesday to Friday) | |
- cron: '0 4,6,8,10,12 * * 3-5' | |
# Runs on the 27th of every month at 12 PM (Beijing time, UTC+8). | |
# Converted to UTC, 12 PM Beijing time is 4 AM UTC. | |
- cron: '0 4 27 * *' | |
# Runs on the 30th of every month at 2 PM (Beijing time, UTC+8). | |
# Converted to UTC, 2 PM Beijing time is 6 AM UTC. | |
- cron: '0 6 30 * *' | |
# Runs every day at 1 AM Beijing time (5 PM UTC the previous day). | |
- cron: '0 17 * * *' | |
# Runs every day at 11 AM Beijing time (3 AM UTC). | |
- cron: '0 3 * * *' | |
# Reminds to go to parents' house next day: 9 PM Beijing Time (1 PM UTC) on Tue, Wed, Thu. | |
- cron: '0 13 * * 2-4' | |
# Reminds to go to own house next day: 9 PM Beijing Time (1 PM UTC) on Sun, Mon, Fri, Sat. | |
- cron: '0 13 * * 0,1,5,6' | |
# Reminds to buy fresh produce direct from the source in JD.com: 9 PM Beijing Time (1 PM UTC) on Wednesday. | |
- cron: '0 13 * * 3' | |
# New: Reminds to buy food that is quick delivered from JD.com: 9 PM Beijing Time (1 PM UTC) on Friday. | |
- cron: '0 13 * * 5' | |
workflow_dispatch: # Allows manual triggering | |
concurrency: | |
group: 'reminders' | |
cancel-in-progress: false | |
jobs: | |
send-reminders: | |
runs-on: ubuntu-latest | |
environment: github-pages | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 5 | |
- name: Set up Python 3.10.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.simple.txt | |
- name: Run Telegram script for daily punch card reminders | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Punch card in WeCom" | |
if: github.event.schedule == '0 4,6,8,10,12 * * 3-5' | |
- name: Run Telegram script for monthly mortgage reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Prepare house mortgage deduction" | |
if: github.event.schedule == '0 4 27 * *' | |
- name: Run Telegram script for monthly salary check reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Check salary" | |
if: github.event.schedule == '0 6 30 * *' | |
- name: Run Telegram script for sleep reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Time to sleep!" | |
if: github.event.schedule == '0 17 * * *' | |
- name: Run Telegram script for wake up reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Time to wake up!" | |
if: github.event.schedule == '0 3 * * *' | |
- name: Run Telegram script for parents' house reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Go to house of parents tomorrow!" | |
if: github.event.schedule == '0 13 * * 2-4' | |
- name: Run Telegram script for own house reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Go to your house tomorrow!" | |
if: github.event.schedule == '0 13 * * 0,1,5,6' | |
- name: Run Telegram script for JD.com fresh produce reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Buy fresh produce direct from the source in JD.com!" | |
if: github.event.schedule == '0 13 * * 3' | |
- name: Run Telegram script for JD.com quick delivery food reminder | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "Buy quick delivery food from JD.com!" | |
if: github.event.schedule == '0 13 * * 5' | |
- name: Run Telegram script for test message | |
env: | |
TELEGRAM_BOT2_API_KEY: ${{ secrets.TELEGRAM_BOT2_API_KEY }} | |
run: python scripts/release/reminders_bot.py --job send_message --message "This is a test message from GitHub Actions." | |
if: github.event_name == 'workflow_dispatch' |