Step 3 - Run the Script
Update your config to send issues to a different GitHub repo.
1. Run the Script
Execute the script using Python:
python email-to-issue.py
The script will:
- Fetch unread emails from the configured inbox.
- Process the subject and body to clean up signatures and extract relevant information.
- Create GitHub issues using the GitHub API and attach files from the email (if any).
2. Monitor the Log File
Check the email_to_issue.log file for logs related to issue creation, including any errors or issues that might have occurred during execution.
Optional:
- Use cron for simple, scheduled execution
- Use systemd for long-running, resilient services
-
Crontab:
Open your user’s crontab editor
crontab -eThe following example runs the script every 5 minutes
*/5 * * * * /usr/bin/python3 /full/path/email-to-issue.py >> /var/log/email-to-issue.log 2>&1Explanation:
- */5 * * * * → run every 5 minutes
- /usr/bin/python3 → full path to the Python interpreter
- /full/path/email-to-issue.py → full path to the script
-
/var/log/email-to-issue.log → append output to a log file
- 2>&1 → redirect errors to the same log file
-
Systemd:
Create a systemd service file
sudo nano /etc/systemd/system/email-to-issue.serviceAdd the following configuration
[Unit] Description=Email to GitHub Issue Service After=network.target [Service] ExecStart=/usr/bin/python3 /full/path/email-to-issue.py WorkingDirectory=/full/path Restart=always User=yourusername EnvironmentFile=/full/path/.env [Install] WantedBy=multi-user.targetReload systemd and enable the service
sudo systemctl daemon-reload sudo systemctl enable email-to-issue sudo systemctl start email-to-issueView logs
journalctl -u email-to-issue -f