GitHubGuard is a lightweight Python package to automatically create GitHub issues from your scripts. It allows you to capture exceptions or messages in your Python code and turn them into issues in one or multiple repositories, with optional labels and assignees.
- Automatically create GitHub issues from Python scripts
- Global configuration for token and default repository
- Create issues in different repositories dynamically
- Add custom title, labels, and assignees
- Easy to import and use across multiple scripts
- Fully compatible with Python 3.8+
Install via pip:
pip install GitHubGuardOr if using your local development version:
pip install -e .from GitHubGuard import config, create_issue
# Configure once
config(token="your-github-token", default_repo="username/MyRepo")
try:
1 / 0
except Exception as e:
create_issue(
str(e),
title="Critical error in script",
labels=["bug", "urgent"],
assignees=["username1", "username2"]
)token– Your GitHub personal access tokendefault_repo– Default repository in owner/repo formattitle– Optional custom title (default: first 50 characters of message)labels– List of labels to assign to the issueassignees– List of GitHub usernames to assign the issue
You can also create issues in different repositories without changing the global configuration:
create_issue(
"Another error occurred",
repo="username/OtherRepo",
labels=["enhancement"],
)This project is licensed under the MIT License.
Feel free to fork, modify, and submit pull requests. Bug reports and suggestions are welcome!