This Python script, commitChecker.py
, sends a reminder email to you if no GitHub commits are found for the current day. It's a handy tool for developers who want to keep their GitHub commit graph green and need a little nudge to make daily commits.
-
Clone the Repository: Clone this repository to your local machine using:
git clone <repository_url>
-
Set Up a Virtual Environment: (Optional, but recommended) Create a virtual environment using:
python3 -m venv venv source venv/bin/activate
-
Install Required Libraries: Install the necessary Python libraries using:
pip install smtplib requests PyGithub python-dotenv
-
Configure Environment Variables: Copy the
.env.example
file to a new file named.env
and fill in your details.
-
Run the Script: Execute the script using:
python commitChecker.py
The script will check your GitHub repositories for commits made today, and if none are found, it will send a reminder email to the specified email address.
-
Open the Crontab: Open your user's crontab file by running:
crontab -e
-
Add the Cron Job: Add the following line to the crontab file to run the script every day at 8 PM:
0 20 * * * /usr/bin/python /path/to/your/commitChecker.py
Make sure to replace
/path/to/your
with the actual path to thecommitChecker.py
file, and update the Python path if needed. -
Save and Exit: Save the crontab file and exit the editor. The new cron job will now run at the specified time.
- Add More Repositories: By default, the script checks all repositories you have access to. Modify the
get_repos
function if you want to customize the repositories being checked. - Customize Email Content: You can change the email subject and body in the
send_email_notification
function.
Make sure to keep your .env
file secure, as it contains sensitive information such as email credentials and GitHub personal access tokens.
Feel free to fork this repository and submit pull requests. Any contributions are welcome!
This project is open-source and available under the MIT License.