Skip to content

Commit

Permalink
contrib: print last updated
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Sep 8, 2023
1 parent 7236d00 commit 9bd9053
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: {fetch-depth: 0}
- uses: actions/setup-python@v4
with: {python-version: '3.x'}
- id: pages
Expand Down
7 changes: 6 additions & 1 deletion committers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def visit_committers_html(self, node):
self.body.append(self.starttag(node, 'div'))
self.body.append("Authors: ")
self.body.append(", ".join(f'<a href="{href}">{name}</a>' for name, href in node['authors']))
self.body.append("<br/>")
self.body.append("Last updated: ")
days = timedelta(seconds=time() - node['last_updated']).days
self.body.append(f"{ctime(node['last_updated'])} ({days} day{'' if days == 1 else 's'} ago)")


def depart_committers_html(self, node):
Expand Down Expand Up @@ -80,7 +84,8 @@ def run(self):
auths.append((name, f"https://github.com/{user}"))
else:
auths.append((name, f"mailto:{email}"))
return [committers_node(authors=auths)]
updated = max(map(int, re.findall(r"^author-time (\d+)$", blame, flags=re.MULTILINE)))
return [committers_node(authors=auths, last_updated=updated)]


def setup(app: Sphinx):
Expand Down

0 comments on commit 9bd9053

Please sign in to comment.