Skip to content

Instantly share code, notes, and snippets.

@rg3915
Last active June 28, 2021 05:24
Show Gist options
  • Save rg3915/15f76bf57d6ca2eddf0ceda051275bbd to your computer and use it in GitHub Desktop.
Save rg3915/15f76bf57d6ca2eddf0ceda051275bbd to your computer and use it in GitHub Desktop.
A simple Python script that can create an issue on a specific repository. github cli github issues
"""
requires the "PyGitHub" package (`pip install pygithub`).
You can leave out things like an assignee, a label etc., by simply leaving them out of the code.
"""
from github import Github
import os
from pprint import pprint
token = "INSERT YOUR PERSONAL-ACCESS-TOKEN HERE"
client = Github(token)
repo = client.get_repo("USERNAME/REPONAME")
issue = repo.create_issue(
title="TITLE OF THE ISSUE",
body="TTEXT OF THE ISSUE",
assignee="SOMEONE",
labels=[
repo.get_label("SOME LABEL")
]
)
pprint(issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment