Created
April 4, 2021 12:48
-
-
Save mylamour/14e11d46fedca8c801cc37ffde15d701 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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