Skip to content

上流バージョン監視の自動化(cron + 自動 Issue 起票) - #189

Open
k-yoshimi wants to merge 4 commits into
developfrom
fix/183-version-watch
Open

上流バージョン監視の自動化(cron + 自動 Issue 起票)#189
k-yoshimi wants to merge 4 commits into
developfrom
fix/183-version-watch

Conversation

@k-yoshimi

Copy link
Copy Markdown
Collaborator

概要

Fixes #183

version.sh の pin と上流の最新 GitHub リリースを定期比較し、更新があれば Issue を自動起票する仕組みを追加します。

scripts/check_upstream_versions.sh

  • 各パッケージの download.sh から ${__VERSION__} でバージョン指定された github.com URL を抽出し owner/repo を自動導出(コメント行は除外、${__NAME__} は展開、変数が残る URL はスキップ)
  • タグの接頭辞を正規化(v3.6.0 / v.1.5.0 / qe-7.0 → 数値部分)し、sort -Vpin より新しい場合のみ報告(espresso のように正式リリースが pin より古い上流を誤検出しない)
  • --create-issues 指定時、[<name>] New upstream version <ver> の Issue を起票。同名の open Issue があればスキップ(重複防止)
  • GitHub Releases を持たない上流(aenet, xtensor 等)と GitHub 外ホスト(openmx, respack 等)は対象外としてスキップ表示

.github/workflows/version_watch.yml

  • 月 2 回(1日・15日)の cron + workflow_dispatch(手動実行)
  • issues: write 権限で --create-issues 実行

検証

  • ライブ API に対するドライラン(Issue 起票なし)で 21 の GitHub ホストパッケージを検査し、16 件の実際の更新(hphi 3.5.2→3.6.0、alpscore 2.3.2→2.3.3、spglib 2.5.0→2.7.0 等)を誤検出ゼロで検出
  • 開発中に発見した誤検出 4 パターン(コメント行の別リポジトリ URL、${__NAME__} 未展開、v. 接頭辞、上流リリースが pin より古い)はすべて解消済み
  • shellcheck (--severity=warning -s sh) クリーン(共有スクリプトのクォート修正 + shellcheck の CI 導入 #178 の CI 対象に入っても通ります)

運用メモ

マージ後の初回実行で最大 16 件の Issue が一度に立ちます。多すぎる場合は先に主要パッケージのバージョン更新を済ませるか、手動 dispatch で様子を見てから cron に任せてください。

🤖 Generated with Claude Code

k-yoshimi and others added 4 commits July 8, 2026 07:51
scripts/check_upstream_versions.sh derives the GitHub owner/repo of
each package from its download.sh, compares the version.sh pin with
the latest GitHub release (prefix-normalized, sort -V so an upstream
whose formal releases lag the pin is not flagged), and optionally
opens one issue per outdated package, skipping ones already open.
The version watch workflow runs it twice a month and on manual
dispatch.

Dry-run against the live API checks 21 GitHub-hosted packages and
currently reports 16 genuinely outdated ones with no false positives.

Fixes #183

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- gh api failures other than 404/no-releases (auth, rate limit,
  network) are now reported per package and make the script exit
  nonzero, so a scheduled run cannot silently skip everything
  (verified: invalid token -> ERROR lines + exit 1)
- URL detection also matches v"$__VERSION__" (unbraced), adding
  pybind11 and einsums to the checked set -- both turn out outdated
- A pre-release pin (e.g. 1.0-beta) is treated as older than the
  released base version even though sort -V orders it after
- Duplicate-issue detection compares open titles locally instead of
  relying on GitHub search syntax

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Open issue titles are fetched once up front (fatal on failure, so
--create-issues cannot silently skip duplicate detection), created
titles are appended locally, and a failed gh issue create is counted
as an error making the run exit nonzero.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- New issues per run are capped by MAX_ISSUES (default 10) so the
  first scheduled run cannot flood watchers; skipped ones are listed
  and picked up by later runs
- -h/--help prints usage instead of running 50 API calls
- scripts/README.md documents the shared and maintenance scripts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@k-yoshimi

Copy link
Copy Markdown
Collaborator Author

AI review cycle (Codex + Antigravity) 結果

Phase 1 (Codex): 2 巡実施。

  • 1 巡目 must_fix 1 / should_fix 2: (a) API エラー(認証・rate limit・ネットワーク)が「リリースなし」と区別されず、定期実行が静かに全パッケージをスキップし得る → 404 のみスキップし、他は ERROR 表示 + 非ゼロ終了に修正(無効トークンで exit 1 を実証)。(b) v"$__VERSION__"(brace なし)形式の URL が対象外 → 検出パターン拡張で pybind11 / einsums が新たに検査対象に入り、両方とも実際に古いことが判明。(c) プレリリース pin(chiq の 1.0-beta)は sort -V で安定版 1.0 より新しい扱いになり更新を見逃す → pin が X-suffix で最新が X なら outdated とする規則を追加。
  • 2 巡目 should_fix 1: gh issue list/create の失敗が握り潰される → open Issue 一覧をループ外で 1 回取得(失敗は即 Fatal)、create 失敗はエラー計上で非ゼロ終了に。

Phase 2 (Antigravity): must_fix_docs 0 → 追加対応:

  • 初回実行の Issue 洪水(~18 件)対策として MAX_ISSUES(デフォルト 10/回、環境変数で変更可)のキャップを追加。超過分は表示のみで次回実行が拾う
  • -h/--help で usage を出して即終了(従来は 50 回超の API 呼び出しが走っていた)
  • scripts/README.md を新設し、共有スクリプトと保守ツールを一覧化

最終状態: dry-run で 23 パッケージ検査 / 18 件の実更新検出 / 誤検出 0 / shellcheck クリーン。

→ 両フェーズ収束。

@k-yoshimi
k-yoshimi changed the base branch from master to develop July 7, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[保守] 上流の新バージョン検出を自動化する(Actions cron + 自動 Issue 起票)

2 participants