From 9ea588fdf8979cc84f13a962daacc01ba23e6034 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Wed, 1 Jun 2022 18:52:39 +0200 Subject: Close issues of older versions Close the corresponding version if an older issue, if a newer update is available to reduce clutter --- rss_to_gitea/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'rss_to_gitea/main.py') diff --git a/rss_to_gitea/main.py b/rss_to_gitea/main.py index 8d31197..7de5106 100644 --- a/rss_to_gitea/main.py +++ b/rss_to_gitea/main.py @@ -37,11 +37,15 @@ def main(): issue_title = f'{feed["name"]}: {latest["title"]}' print("Title=", issue_title) - ticket = api.searchIssue(config.owner, config.repo, issue_title, [config.label]) + ticket = api.getFirstExactIssue(config.owner, config.repo, issue_title, [config.label]) if ticket is not None: print(f'{issue_title} already exists. Skipping') continue - print(feed) + # should we maybe just rename here? + prev_versions = api.getAllIssuesStartingWith(config.owner, config.repo, f'{feed["name"]}: ', [config.label], _state='open') + for prev in prev_versions: + print(f'{prev["title"]} (#{prev["number"]}) already exists. closing.') + api.changeIssueState(config.owner, config.repo, prev['number'], 'closed') result = api.createIssue(config.owner, config.repo, issue_title, latest['link'], feed['assign'], [label_id]) -- cgit v1.2.3