Add event reminder workflows #3
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: Reminder for Hikes with The Chair | ||
'on': | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: '2024-09-27T14:00:00Z' | ||
jobs: | ||
send_email: | ||
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: Send email | ||
run: "python - <<EOF\n\nimport smtplib\nfrom email.mime.multipart import MIMEMultipart\n\ | ||
from email.mime.text import MIMEText\n\nsender_email = \"[email protected]\"\ | ||
\nreceiver_email = \"[email protected]\"\ncc_email = \"[email protected],\ | ||
\ [email protected]\"\nsubject = \"Hikes with The Chair Reminder\"\ | ||
\n\nmsg = MIMEMultipart(\"alternative\")\nmsg['From'] = sender_email\nmsg['To']\ | ||
\ = receiver_email\nmsg['Cc'] = cc_email\nmsg['Subject'] = subject\n\ntext\ | ||
\ = \"\"\"Hi Michelle,\n\nCould you please send out the announcement below\ | ||
\ to the department?\n\nThanks very much!\n\nBest,\nThe PBS Social Committee\n\ | ||
\n===BEGIN===\nPBS Social Committee Calendar of Events\n\nHikes with The Chair\ | ||
\ \U0001FA91\U0001F6B6\U0001F6B6\U0001F6B6\n\nJoin us for weekend hikes with\ | ||
\ The Chair. Enjoy nature and good company as we explore local trails.\n\n\ | ||
**Date:** Weekends throughout the term\n**Time:** TBD\n**Location:** Meet\ | ||
\ at Moore Hall then head to the trail\n\nHappy hiking!\n\nBest,\nThe PBS\ | ||
\ Social Committee\n\n\n===END===\n\"\"\"\nhtml = \"\"\"<html><body><p>PBS\ | ||
\ Social Committee Calendar of Events</p>\n<p>Hikes with The Chair \U0001FA91\ | ||
\U0001F6B6\U0001F6B6\U0001F6B6</p>\n<p>Join us for weekend hikes with The\ | ||
\ Chair. Enjoy nature and good company as we explore local trails.</p>\n<p><strong>Date:</strong>\ | ||
\ Weekends throughout the term\n<strong>Time:</strong> TBD\n<strong>Location:</strong>\ | ||
\ Meet at Moore Hall then head to the trail</p>\n<p>Happy hiking!</p>\n<p>Best,\n\ | ||
The PBS Social Committee</p></body></html>\"\"\"\n\npart1 = MIMEText(text,\ | ||
\ \"plain\")\npart2 = MIMEText(html, \"html\")\n\nmsg.attach(part1)\nmsg.attach(part2)\n\ | ||
\nserver = smtplib.SMTP('smtp.gmail.com', 587)\nserver.starttls()\nserver.login(sender_email,\ | ||
\ \"${ secrets.GMAIL_PASSWORD }\")\ntext = msg.as_string()\nserver.sendmail(sender_email,\ | ||
\ receiver_email.split(\", \") + cc_email.split(\", \"), text)\nserver.quit()\n\ | ||
\nEOF" |