From 4d65867588f6ce2b22eb2c571c3ae58ff4ff7b70 Mon Sep 17 00:00:00 2001 From: Pavel Kuznetsov Date: Mon, 30 Nov 2026 12:59:29 +0300 Subject: [PATCH 1/2] fix(ci): resume catalog discovery after GitHub quota resets --- .github/workflows/catalog.yml | 2 +- scripts/build_catalog.py | 26 ++++++++++++++++++++------ tests/test_pages_catalog.py | 16 ++++++++++++++++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.github/workflows/catalog.yml b/.github/workflows/catalog.yml index 11d5d53..23cf09f 100644 --- a/.github/workflows/catalog.yml +++ b/.github/workflows/catalog.yml @@ -32,7 +32,7 @@ concurrency: jobs: build: runs-on: ubuntu-latest - timeout-minutes: 45 + timeout-minutes: 90 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: diff --git a/scripts/build_catalog.py b/scripts/build_catalog.py index 48f0eed..41c53b7 100644 --- a/scripts/build_catalog.py +++ b/scripts/build_catalog.py @@ -22,17 +22,31 @@ TARGETS = (("windows", "x64"), ("mac", "arm64"), ("mac", "x64")) -def build_catalog(owners): +def build_catalog(owners, session=None): + def fetch(operation, *args): + while True: + try: + return operation(*args) + except releases.SessionEnded: + raise + except releases.RateLimited: + delay = max(1, releases.retry_at(session) - time.time() + 1) + print(f"GitHub API quota exhausted. Retrying in {delay:.0f} seconds.", flush=True) + time.sleep(delay) + + def repositories(owner): + return list(releases.public_repositories(owner)) + catalogs = {target: {owner: [] for owner in owners} for target in TARGETS} stars = dict.fromkeys(owners, 0) count = 0 for owner in owners: - for source in releases.public_repositories(owner): + for source in fetch(repositories, owner): repo = source["repo"] - history = releases.history(repo) + history = fetch(releases.history, repo) if not history: continue - latest = releases.latest_option(repo) + latest = fetch(releases.latest_option, repo) descriptions = {} listed = False for platform, arch in TARGETS: @@ -46,7 +60,7 @@ def rank(option): current if current["tag"] else options[0]) tag = selected["tag"] if tag not in descriptions: - descriptions[tag] = releases.describe_release(source, selected, {}) + descriptions[tag] = fetch(releases.describe_release, source, selected, {}) entry = descriptions[tag] if entry["isAddin"]: catalogs[platform, arch][owner].append({ @@ -168,7 +182,7 @@ def build(output): session = releases.GitHubSession(github_auth.Tokens(token)) if token else None with releases.use_session(session): directory = json.loads((ROOT / trusted_stores.FILENAME).read_text(encoding="utf-8")) - catalogs, count, stars = build_catalog(trusted_stores.parse(directory)) + catalogs, count, stars = build_catalog(trusted_stores.parse(directory), session) output.mkdir(parents=True) publish_artwork(catalogs, output / "artwork") for (platform, arch), owners in catalogs.items(): diff --git a/tests/test_pages_catalog.py b/tests/test_pages_catalog.py index 9e9e871..c9e1a15 100644 --- a/tests/test_pages_catalog.py +++ b/tests/test_pages_catalog.py @@ -11,6 +11,22 @@ class CatalogBuildTests(unittest.TestCase): + def test_rate_limit_wait_resumes_at_current_repository(self): + from scripts import build_catalog + + session = build_catalog.releases.GitHubSession(None) + session.retry_at = 120 + sources = [{"repo": "org/a"}, {"repo": "org/b"}] + with (patch.object(build_catalog.releases, "public_repositories", return_value=sources) as repos, + patch.object(build_catalog.releases, "history", + side_effect=[[], build_catalog.releases.RateLimited(), []]) as history, + patch.object(build_catalog.time, "time", return_value=100), + patch.object(build_catalog.time, "sleep") as sleep): + build_catalog.build_catalog(["org"], session) + repos.assert_called_once_with("org") + self.assertEqual([call.args[0] for call in history.call_args_list], ["org/a", "org/b", "org/b"]) + sleep.assert_called_once_with(21) + def test_build_uses_workflow_token_for_repository_metadata(self): from scripts import build_catalog From 8fdfced5fefee93c5eb29c705fe26ce7892fb0d1 Mon Sep 17 00:00:00 2001 From: Pavel Kuznetsov Date: Mon, 30 Nov 2026 13:00:11 +0300 Subject: [PATCH 2/2] ci: schedule the catalog refresh daily --- .github/workflows/catalog.yml | 2 +- docs/PUBLISHER_GUIDE.md | 2 +- docs/PUBLISHER_GUIDE.ru.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/catalog.yml b/.github/workflows/catalog.yml index 23cf09f..92d71ef 100644 --- a/.github/workflows/catalog.yml +++ b/.github/workflows/catalog.yml @@ -2,7 +2,7 @@ name: Publish Community Store index on: schedule: - - cron: '17 * * * *' + - cron: '17 2 * * *' workflow_dispatch: push: branches: [main] diff --git a/docs/PUBLISHER_GUIDE.md b/docs/PUBLISHER_GUIDE.md index c43a269..72359be 100644 --- a/docs/PUBLISHER_GUIDE.md +++ b/docs/PUBLISHER_GUIDE.md @@ -24,7 +24,7 @@ To list your GitHub profile or organization by default, open a public request wi Community Store maintainers manage default owners in [trusted-stores.json](../trusted-stores.json). After approving a request, maintainers add the GitHub login to the `additionalOwners` array and merge the change into `main`. Clients through 1.2.0 read the original 32 entries in `owners`. The next client build reads both lists and caches the combined directory for offline use. This file is outside the add-in release paths, so a change to this file alone updates the directory without publishing a new Store release. Community Store checks for changes at launch, when the palette opens, and during catalog checks. It keeps the last valid list for offline use and preserves manually added sources. A fresh installation uses `4FusionLab` until it retrieves a valid list. -The Pages-enabled client reads default catalog entries and version history from snapshots built hourly by GitHub Actions. Allow time for the next successful Pages deployment and client refresh after publishing a release. Manually subscribed owners outside the default catalog are checked directly on GitHub. +The Pages-enabled client reads default catalog entries and version history from snapshots built daily by GitHub Actions and whenever the publisher list changes. Maintainers can also trigger a build manually. Allow time for the next successful Pages deployment and client refresh after publishing a release. Manually subscribed owners outside the default catalog are checked directly on GitHub. In the next Store build, the Pages snapshot also supplies the default catalog’s icons, thumbnails, screenshots and localized README files. The list loads the thumbnail and icon on demand. Opening the detail page loads the selected README and larger images. The same tagged files and artwork priorities below apply to indexed and manually subscribed sources. diff --git a/docs/PUBLISHER_GUIDE.ru.md b/docs/PUBLISHER_GUIDE.ru.md index 1d16b87..79ec6fb 100644 --- a/docs/PUBLISHER_GUIDE.ru.md +++ b/docs/PUBLISHER_GUIDE.ru.md @@ -24,7 +24,7 @@ Community Store также распознаёт обычный аддин Fusion Команда Community Store ведёт список источников по умолчанию в файле [trusted-stores.json](../trusted-stores.json). Одобрив заявку, команда добавляет логин владельца GitHub в массив `additionalOwners` и вносит изменение в ветку `main`. Клиенты до версии 1.2.0 включительно читают исходные 32 записи в `owners`. Следующая сборка клиента читает оба списка и сохраняет объединённый каталог для работы офлайн. Файл лежит за пределами списка путей выпуска аддина. Правка только этого файла обновляет список источников без выпуска новой версии Store. Community Store проверяет изменения при запуске, открытии палитры и проверках каталога. Последний корректный список доступен офлайн, источники, добавленные вручную, сохраняются. В новой установке доступен `4FusionLab` до получения корректного списка. -Версия клиента с поддержкой Pages получает карточки каталога по умолчанию и историю версий из индекса. GitHub Actions собирает его раз в час. После публикации релиза карточка обновится при следующей успешной публикации Pages и проверке на устройстве. Источники, добавленные пользователем вне каталога по умолчанию, проверяются напрямую через GitHub. +Версия клиента с поддержкой Pages получает карточки каталога по умолчанию и историю версий из индекса. GitHub Actions собирает его раз в сутки, а также при изменении списка издателей. Сопровождающие могут запустить сборку вручную. После публикации релиза карточка обновится при следующей успешной публикации Pages и проверке на устройстве. Источники, добавленные пользователем вне каталога по умолчанию, проверяются напрямую через GitHub. В следующей сборке Store индекс Pages также поставляет значки, миниатюры, скриншоты и локализованные README стандартного каталога. В списке по мере просмотра загружаются миниатюра и значок. При открытии карточки загружаются выбранный README и полноразмерные изображения. Для стандартных и вручную добавленных источников действуют описанные ниже правила выбора файлов из тега и приоритеты изображений.