diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 249358eb9..9d1e9ea70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,7 @@ jobs: run: | python -m pip install --upgrade pip pip install PyGithub + pip install timeago - name: Run script and commit changes run: | python release.py diff --git a/index.html b/index.html index 01aacbd8a..3abfa1c31 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@ --- {% assign org_href = "https://github.com/elementary" %} +{% assign now = 'now' | date: '%s' | plus: 0 %} @@ -16,6 +17,7 @@ {% unless site.data.blacklist contains repo.name %} {% assign repo_href = org_href | append: "/" | append: repo.name %} {% assign commits_href = repo_href | append: "/compare/" | append: repo.releases.first.version | append: "...master" %} + {% assign release_date_seconds = repo.releases.first.release_date | date: '%s' | plus: 0 %} {% endunless %} diff --git a/release.py b/release.py index 717e68f90..55e852ff3 100644 --- a/release.py +++ b/release.py @@ -1,4 +1,5 @@ import datetime +import timeago import json import os import sys @@ -52,6 +53,7 @@ def __init__(self, repo): releases.append ({ "version": release.tag_name, "release_date": release.created_at.isoformat(), + "timeago": timeago.format(release.created_at, now), "title": release.title, "body": release.body, "href": release.html_url
{{ repo.name }} @@ -28,23 +30,30 @@ {% if repo.new_commits == 0 %} Up to date + {% elsif release_date_seconds > (now - 2419200) %} + + Recent Release + {% elsif repo.new_commits == 1 %} {{ repo.new_commits }} commit - {% elsif repo.new_commits > 1 and repo.new_commits < 15 %} + {% elsif repo.new_commits <= 15 %} {{ repo.new_commits }} commits - {% elsif repo.new_commits >= 15 and repo.new_commits < 50 %} + {% elsif repo.new_commits <= 50 %} {{ repo.new_commits }} commits - {% elsif repo.new_commits >= 50 %} + {% else %} {{ repo.new_commits }} commits {% endif %} +