diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-06-01 18:52:39 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-06-01 18:52:39 +0200 |
commit | 9ea588fdf8979cc84f13a962daacc01ba23e6034 (patch) | |
tree | 6dc4a3651bda40352d90cbc317d58d4777469fc0 /rss_to_gitea/main.py | |
parent | 50e12f3df208637adc6bbe2017665dcc60e448a5 (diff) | |
download | atom_to_gitea-9ea588fdf8979cc84f13a962daacc01ba23e6034.tar.gz |
Close issues of older versions
Close the corresponding version if an older issue,
if a newer update is available to reduce clutter
Diffstat (limited to 'rss_to_gitea/main.py')
-rw-r--r-- | rss_to_gitea/main.py | 8 |
1 files changed, 6 insertions, 2 deletions
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]) |