mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Show only changes of last month in recent updates list
This commit is contained in:
@@ -3,15 +3,23 @@
|
|||||||
|
|
||||||
import io
|
import io
|
||||||
from github import Github
|
from github import Github
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
g = Github()
|
g = Github()
|
||||||
|
|
||||||
|
one_month_ago = datetime.now() - timedelta(days=32)
|
||||||
|
|
||||||
|
def filter_date(issue):
|
||||||
|
return issue.closed_at > one_month_ago
|
||||||
|
|
||||||
with io.open("templates/recent-updates.html", 'w', encoding='utf8') as recent_updates:
|
with io.open("templates/recent-updates.html", 'w', encoding='utf8') as recent_updates:
|
||||||
recent_updates.truncate()
|
recent_updates.truncate()
|
||||||
|
|
||||||
recent_updates.write(u"<ul>\n")
|
recent_updates.write(u"<ul>\n")
|
||||||
|
|
||||||
for pr in g.search_issues("is:merged", repo="phil-opp/blog_os", type="pr", label="relnotes")[:10]:
|
issues = g.search_issues("is:merged", repo="phil-opp/blog_os", type="pr", label="relnotes")[:10]
|
||||||
|
|
||||||
|
for pr in filter(filter_date, issues):
|
||||||
link = '<a href="' + pr.html_url + '">' + pr.title + "</a> "
|
link = '<a href="' + pr.html_url + '">' + pr.title + "</a> "
|
||||||
iso_date = pr.closed_at.isoformat()
|
iso_date = pr.closed_at.isoformat()
|
||||||
readable_date = pr.closed_at.strftime("%b %d")
|
readable_date = pr.closed_at.strftime("%b %d")
|
||||||
|
|||||||
Reference in New Issue
Block a user