From fd915d92a390596c4b388e0264fd6a0f79590ec9 Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Thu, 7 Sep 2023 13:26:15 +0200 Subject: [PATCH] Add counter and report for each service checked --- issue_generator.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/issue_generator.py b/issue_generator.py index 317542b..00d0cc3 100755 --- a/issue_generator.py +++ b/issue_generator.py @@ -146,6 +146,7 @@ class FeedReader: return None return feed.entries[0] + def read_feed(self) -> bool | None: '''Read a feed and post an issue if a new item is found''' entry = self.first_item() @@ -219,5 +220,19 @@ class GithubReader(GithubTagReader): if __name__ == "__main__": from config import FEED_READERS + fail = 0 + ok = 0 + posted = 0 for reader in FEED_READERS: - reader.read_feed() + res = reader.read_feed() + if res == None: + print(f"No versions of {reader.name} available.") + fail += 1 + elif res == False: + ok += 1 + elif res == True: + print(f"{reader.name} outdated, issue posted!") + posted += 1 + else: + print(f"{reader.name} read with status {res}") + print(f"I've added {posted} new issues, {fail} items have no versions and {ok} items are up to date.")