Send_Automated_Email #26
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: Send_Automated_Email | |
on: | |
workflow_run: | |
workflows: ["Generate_RespiCast_Forecasts"] # Trigger when this workflow finishes | |
types: | |
- completed | |
# Or you can manually trigger the workflow | |
workflow_dispatch: | |
jobs: | |
send_email_job: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository to access the files | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: List the root directory | |
run: ls -R . # This will list all files in the repository to help debug the file location. | |
# Step 1a: See which files are available | |
- name: List files for debugging | |
run: ls -R ./Forecasting-hubs_models/model_output/figures/ | |
# Step 2: Prepare the email content and attach files | |
- name: Send email via gmail | |
uses: dawidd6/action-send-mail@v3 | |
with: | |
server_address: smtp.gmail.com # gmail SMTP server | |
server_port: 587 # Port for TLS | |
username: ${{ secrets.GMAIL_EMAIL }} | |
password: ${{ secrets.GMAIL_APP_PASSWORD }} | |
subject: RespiCast Forecast Workflow Completed | |
body: Test test | |
to: [email protected] # Replace with the recipient's email address | |
#from: ${{ secrets.GMAIL_EMAIL }} | |
from: [email protected] | |
secure: false | |
attachments: | | |
./Forecasting-hubs_models/model_output/figures/2024-12-04-ECDC-soca_simplex_ILI.jpg | |
./Forecasting-hubs_models/model_output/figures/2024-12-04-ECDC-soca_simplex_ARI.jpg | |
./Forecasting-hubs_models/model_output/figures/2024-12-04-ECDC-soca_simplex_hosp.jpg |