From 5faecacecaac2f83f0ff70ef86f783691b100242 Mon Sep 17 00:00:00 2001 From: r3drun3 Date: Tue, 6 Feb 2024 13:36:55 +0100 Subject: [PATCH] ci: test Signed-off-by: r3drun3 --- send_mail_report.py | 51 +++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/send_mail_report.py b/send_mail_report.py index 21785c4..1c02f50 100644 --- a/send_mail_report.py +++ b/send_mail_report.py @@ -1,18 +1,31 @@ +from email.mime.application import MIMEApplication import os import yaml import smtplib from datetime import datetime from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart -from email.mime.application import MIMEApplication -# Get the path to the script directory -script_directory = os.path.dirname(__file__) -# Prepare the HTML content +# Get the path to the Github Action YAML file +yaml_file_path = os.path.join(os.path.dirname(__file__), '.github/workflows/patch.yaml') + +# Read the YAML file to get the patched image list +with open(yaml_file_path, 'r') as yaml_file: + yaml_content = yaml.load(yaml_file, Loader=yaml.FullLoader) + patched_images = yaml_content.get('jobs', {}).get('immunize', {}).get('strategy', {}).get('matrix', {}).get('images', []) + +print("Patched images:", patched_images) current_timestamp = datetime.now().strftime('%Y-%m-%d') +# Prepare the HTML content subject = 'IMMUNIZE: OCI Images Patching Report' -html_body = f'

Patched Images 💉 {current_timestamp}


' -html_body += 'check the full catalog 📚 here !' -html_body += '

' -html_body += '

Stay Safe! 💪

' -message.attach(MIMEText(html_body, 'html')) # Connect to the GMAIL SMTP server and send the emails with smtplib.SMTP('smtp.gmail.com', 587) as server: @@ -56,4 +66,19 @@ server.login(email_address, email_password) server.sendmail(email_address, recipients, message.as_string()) -print('Emails sent successfully!!') +print('Emails sent successfully!') + + + + + + + + + + + + + + +