From b56e5de2390660f41800febca8100c819b6bb227 Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Tue, 7 Apr 2020 19:03:33 +0100 Subject: [PATCH 1/7] Fix #22: Don't mark release as critical if it's less than a month old Get now and release_date as integers, and stop marking recent releases with warnings and criticals. --- index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 01aacbd8a..b33c8ba05 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 = repo.releases.first.release_date | date: '%s' | plus: 0 %} {% endunless %}
{{ repo.name }} @@ -32,11 +34,15 @@ {{ repo.new_commits }} commit - {% elsif repo.new_commits > 1 and repo.new_commits < 15 %} + {% elsif release_date > (now - 2419200) %} {{ repo.new_commits }} commits - {% elsif repo.new_commits >= 15 and repo.new_commits < 50 %} + {% elsif repo.new_commits > 1 and repo.new_commits < 10 %} + + {{ repo.new_commits }} commits + + {% elsif repo.new_commits >= 10 and repo.new_commits < 50 %} {{ repo.new_commits }} commits From dfb2e926e0bcaa160b6deba6d1f4a797726c7f19 Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Tue, 7 Apr 2020 19:05:21 +0100 Subject: [PATCH 2/7] Update index.html --- index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index b33c8ba05..fa36f946e 100644 --- a/index.html +++ b/index.html @@ -34,10 +34,14 @@ {{ repo.new_commits }} commit - {% elsif release_date > (now - 2419200) %} + {% elsif release_date > (now - 2419200) and repo.new_commits < 50 %} {{ repo.new_commits }} commits + {% elsif release_date > (now - 2419200) and repo.new_commits >= 50 %} + + {{ repo.new_commits }} commits + {% elsif repo.new_commits > 1 and repo.new_commits < 10 %} {{ repo.new_commits }} commits From c64052bc3835cffd899ef1e3a528fad2c5ad649a Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Tue, 7 Apr 2020 19:07:27 +0100 Subject: [PATCH 3/7] Update index.html --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index fa36f946e..d31c865a4 100644 --- a/index.html +++ b/index.html @@ -42,11 +42,11 @@ {{ repo.new_commits }} commits - {% elsif repo.new_commits > 1 and repo.new_commits < 10 %} + {% elsif repo.new_commits > 1 and repo.new_commits < 15 %} {{ repo.new_commits }} commits - {% elsif repo.new_commits >= 10 and repo.new_commits < 50 %} + {% elsif repo.new_commits >= 15 and repo.new_commits < 50 %} {{ repo.new_commits }} commits From 1a3cd0d6e69899ef71bd2057691e877733302245 Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Thu, 23 Apr 2020 01:07:50 +0100 Subject: [PATCH 4/7] Cassidy suggestions, sans timeago --- index.html | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index d31c865a4..27f017465 100644 --- a/index.html +++ b/index.html @@ -30,27 +30,23 @@ {% if repo.new_commits == 0 %} Up to date + {% elsif release_date > (now - 2419200) %} + + Recent Release + {% elsif repo.new_commits == 1 %} {{ repo.new_commits }} commit - {% elsif release_date > (now - 2419200) and repo.new_commits < 50 %} - - {{ repo.new_commits }} commits - - {% elsif release_date > (now - 2419200) and repo.new_commits >= 50 %} - - {{ repo.new_commits }} commits - - {% 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 From 5981a6db23dcacc9afa21c25e82ca63187e8e4ad Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Thu, 23 Apr 2020 01:19:56 +0100 Subject: [PATCH 5/7] Update release.py --- release.py | 2 ++ 1 file changed, 2 insertions(+) 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 From 91f37c96191da6f88fc8900c467629332aff9281 Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Thu, 23 Apr 2020 01:20:16 +0100 Subject: [PATCH 6/7] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) 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 From d83886f7dd42ee12a91a088c5966115edb1e95d4 Mon Sep 17 00:00:00 2001 From: Lewis Goddard Date: Thu, 23 Apr 2020 01:21:54 +0100 Subject: [PATCH 7/7] Update index.html --- index.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 27f017465..3abfa1c31 100644 --- a/index.html +++ b/index.html @@ -17,7 +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 = repo.releases.first.release_date | date: '%s' | plus: 0 %} + {% assign release_date_seconds = repo.releases.first.release_date | date: '%s' | plus: 0 %}
{{ repo.name }} @@ -30,7 +30,7 @@ {% if repo.new_commits == 0 %} Up to date - {% elsif release_date > (now - 2419200) %} + {% elsif release_date_seconds > (now - 2419200) %} Recent Release @@ -51,6 +51,9 @@ {{ repo.new_commits }} commits {% endif %} +