release check code - goes to pushover tho - not discord
This commit is contained in:
28
.gitea/workflows/releases.yaml
Normal file
28
.gitea/workflows/releases.yaml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: ReleaseBot
|
||||||
|
on:
|
||||||
|
# push
|
||||||
|
workflow_dispatch:
|
||||||
|
# schedule:
|
||||||
|
# - cron: '18 */2 * * *'
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3.13"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
- name: Run release_check.py
|
||||||
|
run:
|
||||||
|
python release_check.py
|
||||||
|
env:
|
||||||
|
BOTS_ENDPOINT: ${{ secrets.BOTS_ENDPOINT }}
|
||||||
|
PUSHOVER_ENDPOINT: ${{ secrets.PUSHOVER_ENDPOINT }}
|
||||||
|
PUSHOVER_USER_TOKEN: ${{ secrets.PUSHOVER_USER_TOKEN }}
|
||||||
|
PUSHOVER_BOTS_TOKEN: ${{ secrets.PUSHOVER_BOTS_TOKEN }}
|
||||||
|
REPO_LINKS: ${{ secrets.REPO_LINKS }}
|
@ -31,6 +31,9 @@ quip_token = getenv('QUIP_TOKEN')
|
|||||||
## Quotes file path
|
## Quotes file path
|
||||||
quotes_source = getenv('QUOTES_SOURCE')
|
quotes_source = getenv('QUOTES_SOURCE')
|
||||||
|
|
||||||
|
## Repository links
|
||||||
|
repo_links = getenv('REPO_LINKS').split(',')
|
||||||
|
|
||||||
# Pushover creds
|
# Pushover creds
|
||||||
po_endpoint = getenv('PUSHOVER_ENDPOINT')
|
po_endpoint = getenv('PUSHOVER_ENDPOINT')
|
||||||
po_user_token = getenv('PUSHOVER_USER_TOKEN')
|
po_user_token = getenv('PUSHOVER_USER_TOKEN')
|
||||||
|
20
release_check.py
Normal file
20
release_check.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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:
|
||||||
|
result = get(repo_link)
|
||||||
|
entity = 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}')
|
Reference in New Issue
Block a user