Skip to content

Instantly share code, notes, and snippets.

@mylamour
Created April 4, 2021 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mylamour/14e11d46fedca8c801cc37ffde15d701 to your computer and use it in GitHub Desktop.
Save mylamour/14e11d46fedca8c801cc37ffde15d701 to your computer and use it in GitHub Desktop.
import re
from github import Github
# First create a Github instance:
# using an access token
g = Github("")
# Github Enterprise with custom hostname
repo = g.get_repo("mylamour/blog")
open_issues = repo.get_issues(state="open")
for issue in open_issues:
print(issue)
itime=issue.created_at.isoformat().split('T')[0]
iname=re.sub(r'\W+','_',issue.title)
with open("{}-{}.md".format(itime,iname),'w') as mfile:
content = "---\r\n" + "layout: post\r\n" + "title: {}\r\n".format(issue.title) + "categories: \r\n" + "kerywords: \r\n" + "tags: \r\n"+ "---\r\n" + issue.body
if issue.comments:
for i in issue.get_comments():
content = content + i.body
mfile.write(content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment