Skip to content

Python code to Send email for all the Pull Requests in Last one week for any Github Repository

Notifications You must be signed in to change notification settings

hardik-aws/github-pr-summary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub PRs Summary Email

This Python script obtains a list of the last week's open, closed, and in-draft PRs made in a GitHub repository. After using the GitHub API to retrieve the pull request data, it sends an email with the summary to a given email address.

Prerequisites

  • Python 3.x
  • Requests library
  • Jinja2 library
  • python-dotenv library
  • secure-smtplib library

Setup

  1. Clone or download this repository.

    git clone git@github.com:hardik-aws/github-pr-summery.git
  2. Install the required Python libraries by running the following command:

    pip3 install -r requirements.txt
  3. Copy .env.sample file as a .env file

  4. Set up the GitHub API access token:
    -- Generate a personal access token from your GitHub account settings.
    -- set token value in .env file as GITHUB_TOKEN

  5. Configure the email settings:
    -- Set the SMTP server and port of your email provider in the .env file as SMTP_SERVER and SMTP_PORT
    -- Update EMAIL_ADDRESS and EMAIL_PASSWORD in the .env file for authentication.
    -- Specify the recipient's email address as the USER_EMAIL in the .env file.

  6. Set the target GitHub repository:
    -- Specify GITHUB_USERNAME and GITHUB_REPONAME with the owner's username and repository name in the .env file

Usage

  • Run the Python script using the following command:

    python index.py

This Python script obtains a list of the last week's open, closed, and in-draft PRs from the  GitHub repository. After using the GitHub API to retrieve the pull request data, it sends an email with the summary to a given email address.

Customization

  • Email Template: The email content is generated using an HTML template (template.html). You can customize the template according to your preference by modifying the HTML structure and styling.

  • Email Subject: The subject of the email is defined in the script. Modify the Subject field in the message variable to change the subject line.

About

Python code to Send email for all the Pull Requests in Last one week for any Github Repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published