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 Mid-term Wine and Cheese Gathering | ||
'on': | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: '2024-10-20T14: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 = \"Mid-term Wine and Cheese Gathering\ | ||
\ Reminder\"\n\nmsg = MIMEMultipart(\"alternative\")\nmsg['From'] = sender_email\n\ | ||
msg['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\nMid-term Wine and\ | ||
\ Cheese Gathering \U0001F377\U0001F9C0\n\nCelebrate mid-term with a relaxing\ | ||
\ wine and cheese gathering. Open to all in the PBS community and loved ones.\n\ | ||
\n**Date:** Monday, October 21\n**Time:** 4:00 \u2013 5:30 PM\n**Location:**\ | ||
\ Bucci Lounge, Moore Hall, 2nd floor\n\nWe look forward to your company!\n\ | ||
\nBest,\nThe PBS Social Committee\n\n\n===END===\n\"\"\"\nhtml = \"\"\"<html><body><p>PBS\ | ||
\ Social Committee Calendar of Events</p>\n<p>Mid-term Wine and Cheese Gathering\ | ||
\ \U0001F377\U0001F9C0</p>\n<p>Celebrate mid-term with a relaxing wine and\ | ||
\ cheese gathering. Open to all in the PBS community and loved ones.</p>\n\ | ||
<p><strong>Date:</strong> Monday, October 21\n<strong>Time:</strong> 4:00\ | ||
\ \u2013 5:30 PM\n<strong>Location:</strong> Bucci Lounge, Moore Hall, 2nd\ | ||
\ floor</p>\n<p>We look forward to your company!</p>\n<p>Best,\nThe PBS Social\ | ||
\ Committee</p></body></html>\"\"\"\n\npart1 = MIMEText(text, \"plain\")\n\ | ||
part2 = 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" |