Skip to content

fix: リポジトリメンテナンス(Actions最適化・セキュリティ強化) - #656

Merged
keito4 merged 2 commits into
mainfrom
chore/repo-maintenance-20260402
Apr 2, 2026
Merged

fix: リポジトリメンテナンス(Actions最適化・セキュリティ強化)#656
keito4 merged 2 commits into
mainfrom
chore/repo-maintenance-20260402

Conversation

@keito4

@keito4 keito4 commented Apr 2, 2026

Copy link
Copy Markdown
Owner

Summary

/repo-maintenance による定期メンテナンス実行結果。

Why

  • GitHub Actions のコスト最適化(重複実行防止、暴走ジョブ防止、Artifact ストレージ削減)
  • テンプレートと実ワークフローの SHA 固定の乖離解消
  • AGENTS.md の自動生成セクションが実態と乖離

What

Actions コスト最適化

  • coverage-report.yml: concurrency + 各ジョブに timeout-minutes: 10 追加
  • manual-release.yml: concurrency + timeout-minutes: 30 追加
  • docker-image.yml: upload-artifactretention-days: 7 追加

テンプレート SHA 固定

  • templates/workflows/dependabot-auto-merge.yml: dependabot/fetch-metadata@v2 → SHA 固定
  • templates/workflows/label-sync.yml: actions/checkout@v6, EndBug/label-sync@v2 → SHA 固定

AGENTS.md 更新

  • 自動生成セクションを現在のディレクトリ構成に同期(.agents/, dist/, next/ 追加)

リポジトリ設定変更(API 経由、コミット外)

  • default_workflow_permissions: writeread
  • allowed_actions: allselected(GitHub/verified + 明示的パターン許可)
  • core.hooksPath: .husky/_.husky(v9 移行)
  • 41 マージ済みローカルブランチ削除

How to test

  • CI パス
  • ワークフロー構文エラーなし
  • テンプレートと実ファイルの一致確認済み

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Enhanced workflow reliability with concurrency controls and execution time limits for coverage and release jobs
    • Set artifact retention to 7 days for devcontainer uploads
    • Pinned CI workflow action versions for greater stability
  • Documentation

    • Updated repository structure docs
  • Chores

    • Simplified and replaced repository pull request templates (one removed, one restructured)

- coverage-report.yml: concurrency + timeout-minutes 追加
- manual-release.yml: concurrency + timeout-minutes 追加
- docker-image.yml: upload-artifact に retention-days: 7 追加
- templates/dependabot-auto-merge.yml: SHA 固定
- templates/label-sync.yml: SHA 固定
- AGENTS.md: 自動生成セクション更新(新ディレクトリ追加)
- PR テンプレート: Why/What/How 形式に簡素化

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a963617b-73c6-4408-9056-21026cb6a3f2

📥 Commits

Reviewing files that changed from the base of the PR and between 011865e and 12b1d4b.

📒 Files selected for processing (2)
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/pull_request_template.md

📝 Walkthrough

Walkthrough

Added workflow-level concurrency controls and per-job timeouts across CI workflows, set artifact retention for a devcontainer artifact, pinned several workflow action dependencies to specific commits, and updated AGENTS.md with new repository directories and a hook entry. (≤50 words)

Changes

Cohort / File(s) Summary
Workflow Concurrency & Timeouts
.github/workflows/coverage-report.yml, .github/workflows/manual-release.yml
Added concurrency blocks to workflows and timeout-minutes to several jobs (coverage jobs set to 10m; release job set to 30m).
Artifact Retention
.github/workflows/docker-image.yml
Added retention-days: 7 to actions/upload-artifact step for devcontainer-info.txt.
Action Pinning (Templates)
templates/workflows/dependabot-auto-merge.yml, templates/workflows/label-sync.yml
Replaced loose tags with specific commit SHAs for action usages (pins for dependabot/fetch-metadata, actions/checkout, EndBug/label-sync).
Docs / Repo Structure
AGENTS.md
Inserted .agents/ and new top-level dirs (dist/, next/) into repo-structure table and added a common.py hook entry in the hooks table.
PR Templates
.github/PULL_REQUEST_TEMPLATE.md, .github/pull_request_template.md
Rewrote PR template content (new Japanese-guided sections) and removed the legacy template file contents respectively.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

released

Poem

🐰 A hare hops through YAML, tidy and spry,
Cancelling duplicates that race by.
Timeouts set, artifacts kept seven days,
Pins locked tight in reproducible ways.
AGENTS.md blooms — I nibble and say, “Hooray!” 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main changes: repository maintenance with Actions optimization and security enhancements, which aligns with the changeset scope.
Description check ✅ Passed The PR description follows the required template structure with all sections completed: Summary, Why, What, and How to test are all present and filled out with substantive content.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/repo-maintenance-20260402

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keito4

keito4 commented Apr 2, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項はありません。変更は主にワークフローの同時実行制御・タイムアウト追加・アクションの固定化・ドキュメント表の補完で、正確性/パフォーマンス/セキュリティ/保守性/開発者体験の観点で新たな問題は見当たりません。

patch is correct — 追加変更は安全な運用改善(concurrency/timeout/pin/retention)とドキュメント整備で、挙動を壊すリスクが低い。信頼度 0.62


🤖 Generated by post_pr_ai_review.py hook

@keito4

keito4 commented Apr 2, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項

  • 重大: 同一リファレンスで複数フォーマットのカバレッジを並列実行すると、concurrency が同一グループになり相互にキャンセルされます。これにより一部のカバレッジレポートが欠落する可能性があります。groupinputs.format を含めるか、cancel-in-progress を無効化してください。.github/workflows/coverage-report.yml:50-52

全体判定: patch is incorrect
理由: 並列で複数フォーマットのカバレッジを実行する運用でレポート欠落が起き得るため。
信頼度: 0.57


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@claude

claude Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Code Review

PR の目的は明確で、GitHub Actions のコスト最適化・セキュリティ強化・ドキュメント同期という実用的な改善です。全体的に品質は高いですが、いくつか確認点があります。

良い点

  • SHA ピン固定: dependabot/fetch-metadata、actions/checkout、EndBug/label-sync の SHA 固定はサプライチェーン攻撃対策として正しい実践です。
  • concurrency 設定: coverage-report.yml は cancel-in-progress: true で重複実行防止、manual-release.yml は cancel-in-progress: false でリリース中断防止と、それぞれ適切な設定です。
  • timeout-minutes: coverage-report (10分)、manual-release (30分) は妥当な値です。
  • retention-days: 7 で Artifact ストレージ削減として合理的です。

要確認・改善点

  1. actions/checkout@v6 の SHA 検証

templates/workflows/label-sync.yml にて SHA de0fac2e4500dabe0009e67214ff5f5447ce83dd を参照しています。actions/checkout の現在の最新安定版は v4 であり、v6 は存在しない可能性があります。誤った SHA はワークフローの実行時エラーになります。確認方法: gh api repos/actions/checkout/git/commits/de0fac2e4500dabe0009e67214ff5f5447ce83dd

  1. AGENTS.md の dist/ 説明が不明瞭

「dist」という説明は内容が伝わりません。「Compiled/built output files」など具体的な説明に改善してください。

  1. AGENTS.md の common.py エントリが不完全

Trigger が「Unknown」、説明が「common」では情報として不十分です。実際のトリガー条件と機能を明記してください。自動生成の結果をそのままマージするのではなく、人間がレビューして補完することを推奨します。

  1. coverage-report.yml の timeout-minutes: 10 の妥当性

JaCoCo フォーマット(Java プロジェクト)や大規模な LCOV カバレッジレポートでは 10 分では不足するケースがあります。reusable workflow の timeout はオーバーライド不可なので、15〜20分への引き上げも検討余地があります。

まとめ

actions/checkout@v6 の SHA 検証とドキュメントの細部(dist/ の説明、common.py のトリガー・説明)を修正すれば、マージ問題なしと判断します。

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
AGENTS.md (1)

55-55: Clarify the dist/ purpose text.

Line 55 uses dist as both directory and purpose, which is ambiguous. Prefer a concrete description like “Build artifacts/output bundles.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 55, Update the table row that currently reads "| `dist/`  
| dist                                             |" to use a clear purpose
description; replace the second column value "dist" with a concrete phrase such
as "Build artifacts/output bundles" (or similar) so the entry reads e.g. "|
`dist/` | Build artifacts/output bundles |" to remove ambiguity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Line 142: The hook metadata entry for common.py is currently listing generic
values ("Unknown"/"common"); update that row to describe the actual hook trigger
and responsibility by replacing "Unknown" with the explicit trigger (e.g.,
"pre-commit", "post-merge", "startup", or the webhook/event name) and replace
the "common" responsibility with a concise statement of what common.py does
(e.g., "initializes shared agent state and exposes helper utilities:
load_config(), init_logger(), register_handlers()"), and include any
inputs/outputs or side effects for auditability; locate and edit the AGENTS.md
table row referencing common.py and ensure the metadata fields clearly state
trigger, purpose, and key exported functions/classes used by the hook.

In `@templates/workflows/dependabot-auto-merge.yml`:
- Line 40: The dependabot action pin is using the wrong commit hash for the v2
tag: update the action reference that currently reads
dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a to the
correct SHA dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36
in the workflow file so the uses: line for the dependabot/fetch-metadata action
points to the actual v2 commit.

---

Nitpick comments:
In `@AGENTS.md`:
- Line 55: Update the table row that currently reads "| `dist/`              |
dist                                             |" to use a clear purpose
description; replace the second column value "dist" with a concrete phrase such
as "Build artifacts/output bundles" (or similar) so the entry reads e.g. "|
`dist/` | Build artifacts/output bundles |" to remove ambiguity.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ea6d20b-cde1-4d26-ae3e-9094247eaba1

📥 Commits

Reviewing files that changed from the base of the PR and between 2246f49 and 011865e.

📒 Files selected for processing (6)
  • .github/workflows/coverage-report.yml
  • .github/workflows/docker-image.yml
  • .github/workflows/manual-release.yml
  • AGENTS.md
  • templates/workflows/dependabot-auto-merge.yml
  • templates/workflows/label-sync.yml

Comment thread AGENTS.md
| `block_config_edit.py` | Pre edit | Protect configuration files |
| `block_dangerous_commands.py` | Pre Bash | Block destructive commands |
| `block_git_no_verify.py` | Pre git commit/push | Block `--no-verify` and `HUSKY=0` |
| `common.py` | Unknown | common |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Hook metadata is too vague to be actionable.

Line 142 should not use Unknown/common; please document the actual trigger and specific responsibility of common.py to keep hook operations auditable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 142, The hook metadata entry for common.py is currently
listing generic values ("Unknown"/"common"); update that row to describe the
actual hook trigger and responsibility by replacing "Unknown" with the explicit
trigger (e.g., "pre-commit", "post-merge", "startup", or the webhook/event name)
and replace the "common" responsibility with a concise statement of what
common.py does (e.g., "initializes shared agent state and exposes helper
utilities: load_config(), init_logger(), register_handlers()"), and include any
inputs/outputs or side effects for auditability; locate and edit the AGENTS.md
table row referencing common.py and ensure the metadata fields clearly state
trigger, purpose, and key exported functions/classes used by the hook.

if: github.actor == 'dependabot[bot]'
id: metadata
uses: dependabot/fetch-metadata@v2
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify dependabot/fetch-metadata SHA matches v2 tag
curl -s "https://api.github.com/repos/dependabot/fetch-metadata/git/refs/tags/v2" | jq -r '.object.sha'
echo "Expected SHA in workflow: 21025c705c08248db411dc16f3619e6b5f9ea21a"

Repository: keito4/config

Length of output: 164


SHA does not match v2 tag — update to correct commit hash.

The pinned SHA 21025c705c08248db411dc16f3619e6b5f9ea21a does not correspond to the v2 release. The actual SHA for the v2 tag is ffa630c65fa7e0ecfa0625b5ceda64399aea1b36. Update the action reference to use the correct hash:

Current vs. correct SHA
-        uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2
+        uses: dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36 # v2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@templates/workflows/dependabot-auto-merge.yml` at line 40, The dependabot
action pin is using the wrong commit hash for the v2 tag: update the action
reference that currently reads
dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a to the
correct SHA dependabot/fetch-metadata@ffa630c65fa7e0ecfa0625b5ceda64399aea1b36
in the workflow file so the uses: line for the dependabot/fetch-metadata action
points to the actual v2 commit.

@keito4 keito4 self-assigned this Apr 2, 2026
macOS の case-insensitive FS により PULL_REQUEST_TEMPLATE.md と
pull_request_template.md の2エントリが存在していた問題を修正。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@keito4
keito4 merged commit eb8c3de into main Apr 2, 2026
3 of 4 checks passed
@keito4
keito4 deleted the chore/repo-maintenance-20260402 branch April 2, 2026 12:53
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.108.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant