aboutsummaryrefslogtreecommitdiff
path: root/rss_to_gitea/main.py
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-06-01 18:52:39 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-06-01 18:52:39 +0200
commit9ea588fdf8979cc84f13a962daacc01ba23e6034 (patch)
tree6dc4a3651bda40352d90cbc317d58d4777469fc0 /rss_to_gitea/main.py
parent50e12f3df208637adc6bbe2017665dcc60e448a5 (diff)
downloadatom_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.py8
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])