GitHub Issue Creator
A Python library for creating GitHub issues programmatically using the GitHub REST API.
Summary
Installation
First, install the library via pip (if it's not already installed):
pip install github-issue-creator
Usage
Import the necessary modules
from github_issue_creator import IssueCreator, Issue, IssueCreationError
Initialize IssueCreator
You'll need a GitHub Personal Access Token (PAT), the repository owner's username, and the repository name.
token = "your_github_token"
repo_owner = "your_github_username"
repo_name = "your_repository_name"
creator = IssueCreator(token, repo_owner, repo_name)
Create an Issue object
The Issue model should contain the issue details such as title, body, assignees, labels, etc.
issue = Issue(
title="Sample Issue Title",
body="This is the description of the issue.",
assignees=["octocat"], # Optional: list of GitHub usernames to assign
labels=["bug", "help wanted"] # Optional: list of labels
)
Create the issue on GitHub
Call the create method to post the issue.
try:
creator.create(issue)
except IssueCreationError as e:
print(f"Failed to create issue: {e}")
if e.status_code:
print(f"Status Code: {e.status_code}")
print(f"Response: {e.response_text}")
If successful, it will return an IssueResponse object containing details of the created issue, including the issue URL, repository URL, issue ID, number, title, state, creation date, and the author's username.
For example, it may look like this:
IssueResponse(
repository_url="https://github.com/fake_owner/fake_repo",
issue_url="https://github.com/fake_owner/fake_repo/issues/1",
issue_id=123456,
issue_number=1,
issue_title="Test",
issue_state="open",
created_at="2024-06-01T00:00:00Z",
author="test_user"
)
Exceptions
IssueCreationError: Raised if the issue creation fails due to an HTTP error or a request exception.
Configuration Notes
- Make sure your GitHub token has the correct permissions to create issues in the repository.
- The
Issuemodel should be defined based on the GitHub API's expected fields (check the library'smodels/issue.pyfor the schema).
Contributors
Thanks to the following people who have contributed to this project:
- pzzzl - Maintainer
- BrunoSantanaS
Feel free to open a pull request or report any issues you encounter. Your contributions are always welcome!
Metadata
Release files for github-issue-creator 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| github_issue_creator-0.2.2.tar.gz | 8.7 kB | Without provenance | Details for github_issue_creator-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| github_issue_creator-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for github_issue_creator-0.2.2-py3-none-any.whl |
Total release size: 16.7 kB
Release files / github_issue_creator-0.2.2.tar.gz
| Download URL | github_issue_creator-0.2.2.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
226d56543e97a54670d8ca2068f70de9dfa3bb1e07f7e2a8538e249e8086f88d
|
|
BLAKE2b-256 checksum How to use checksums |
62c1acd838f3fd7992d69d30ec09472705a24124c26f09d2a446ac10628c7679
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / github_issue_creator-0.2.2-py3-none-any.whl
| Download URL | github_issue_creator-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aa1eda7f786153415c9c1a2ca8d6acb43b0dd71e9d9ce6365f14f2fa682d4ad6
|
|
BLAKE2b-256 checksum How to use checksums |
abbd745faede5c87889325d8c9df9cd816a5ad849891e01ba2b96aab2b0ba06f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for github-issue-creator 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.