Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ jobs:
with:
args: --verbose --no-progress plugins.json
fail: true
failIfEmpty: false
token: ${{ secrets.LINKCHECKER }}
35 changes: 30 additions & 5 deletions ci/src/updater.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*-coding: utf-8 -*-
import asyncio
import aiohttp
import re
from typing import List
from unicodedata import name
from os import getenv
from sys import argv
import traceback
Expand All @@ -12,6 +12,11 @@
from _utils import *
from discord import update_hook

github_download_url_regex = re.compile(
r"https://github\.com/(?P<author>[a-zA-Z0-9-]+)/(?P<repo>[a-zA-Z0-9\.\-\_]*)/releases/download/(?P<version>[a-zA-Z\.0-9]+)/(?P<filename>.*)\.zip"
)


async def batch_github_plugin_info(
info: P, tags: ETagsType, github_token=None, webhook_url: str | None = None
) -> P:
Expand Down Expand Up @@ -44,11 +49,31 @@ async def batch_github_plugin_info(

if info.get(release_date, "") != latest_rel.get("published_at"):
info[release_date] = latest_rel.get("published_at")

if assets:
info[url_download] = assets[0]["browser_download_url"]
browser_download_url = None

if len(assets) > 1:
match = github_download_url_regex.match(info[url_download])
if not match:
raise ValueError(
f"Download URL did not mach regex: {info[url_download]!r}"
)
filename = f"{match['filename']}.zip"
for asset in assets:
if asset["browser_download_url"].endswith(filename):
browser_download_url = asset["browser_download_url"]

info[url_download] = (
browser_download_url or assets[0]["browser_download_url"]
)

if webhook_url:
await send_notification(
info, clean(latest_rel["tag_name"], "v"), latest_rel, webhook_url
info,
clean(latest_rel["tag_name"], "v"),
latest_rel,
webhook_url,
)
info[version] = clean(latest_rel["tag_name"], "v")

Expand Down Expand Up @@ -77,7 +102,6 @@ def remove_unused_etags(plugin_infos: PluginsType, etags: ETagsType) -> ETagsTyp
plugin_ids = [info.get("ID") for info in plugin_infos]

for id, tag in etags.items():

if id not in plugin_ids:
print(
f"Plugin with ID {id} has been removed. The associated ETag will be also removed now."
Expand All @@ -94,14 +118,15 @@ async def send_notification(
) -> None:
if not webhook_url:
return

if version_tuple(info[version]) != version_tuple(latest_ver):
tqdm.write(f"Update detected: {info[plugin_name]} {latest_ver}")
try:
await update_hook(webhook_url, info, latest_ver, release)
except Exception as e:
tqdm.write(str(e))


async def main():
webhook_url = None
if len(argv) > 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Website": "https://github.com/blueset/flow-search-unicode",
"IcoPath": "https://cdn.jsdelivr.net/gh/blueset/flow-search-unicode@master/Flow.Launcher.Plugin.SearchUnicode.Identify/icon.png?raw=true",
"UrlSourceCode": "https://github.com/blueset/flow-search-unicode",
"UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.4/SearchUnicode.Emoji.zip",
"UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.4/SearchUnicode.Identify.zip",
"LatestReleaseDate": "2025-02-06T03:49:37Z",
"DateAdded": "2025-01-19T01:42:28Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Website": "https://github.com/blueset/flow-search-unicode",
"IcoPath": "https://cdn.jsdelivr.net/gh/blueset/flow-search-unicode@master/Flow.Launcher.Plugin.SearchUnicode.Search/icon.png?raw=true",
"UrlSourceCode": "https://github.com/blueset/flow-search-unicode",
"UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.4/SearchUnicode.Emoji.zip",
"UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.4/SearchUnicode.Search.zip",
"LatestReleaseDate": "2025-02-06T03:49:37Z",
"DateAdded": "2025-01-19T01:42:28Z"
}
Loading