Files
bots/release_check.py
Camille Frantz 71bc0a606b
All checks were successful
QuipBot / deploy (push) Successful in 15s
DogFacts / deploy (push) Successful in 23s
QuotesBot / deploy (push) Successful in 17s
ReleaseBot / deploy (push) Successful in 29s
whoops - can't split an empty string
2025-06-18 15:55:33 -05:00

23 lines
842 B
Python

from requests import get, post
from datetime import datetime as dt, timezone as tz, timedelta
from time import mktime
from feedparser import parse
from json import loads
from munch import DefaultMunch
from globals import *
now = dt.now(tz.utc)
six_hours_ago = now - timedelta(hours=6)
for repo_link in repo_links.split(','):
result = get(repo_link)
entity = f"{repo_link.split('/')[3]}/{repo_link.split('/')[4]}"
if result.reason == 'OK':
last = DefaultMunch.fromDict(parse(result.text)).entries[0]
timechk = mktime(last.published_parsed or last.updated_parsed)
if timechk > dt.timestamp(six_hours_ago):
if ('prerelease' not in last.title.lower() and 'beta' not in last.title.lower()):
notify(0, f'new release for {entity}: {last.title} - {last.link}')
else:
print(f'no new releases for {entity}')