mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Add before_build script
This commit is contained in:
21
blog/before_build.py
Normal file
21
blog/before_build.py
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import io
|
||||
from github import Github
|
||||
|
||||
g = Github("e62e298b2a46ca5cf474cb9a4c0c1bc950b09d46")
|
||||
|
||||
with io.open("layouts/partials/recent-updates.html", 'w', encoding='utf8') as recent_updates:
|
||||
recent_updates.truncate()
|
||||
|
||||
recent_updates.write(u"<ul>\n")
|
||||
|
||||
for pr in g.search_issues("is:merged", repo="phil-opp/blog_os", type="pr", label="relnotes")[:5]:
|
||||
link = '<a href="' + pr.html_url + '">' + pr.title + "</a> "
|
||||
iso_date = pr.closed_at.isoformat()
|
||||
readable_date = pr.closed_at.strftime("%b %d")
|
||||
datetime = '<time datetime="' + iso_date + '">' + readable_date + '</datetime>'
|
||||
recent_updates.write(u" <li>" + link + datetime + "</li>\n")
|
||||
|
||||
recent_updates.write(u"</ul>")
|
||||
Reference in New Issue
Block a user