From de6301dace41c61748f81623d982ad5d0fb2c4c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 7 Apr 2026 15:40:49 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E8=A4=87=E6=95=B0=E3=83=AA?= =?UTF-8?q?=E3=83=9D=E3=82=B8=E3=83=88=E3=83=AA=E3=81=AE=E5=85=B1=E9=80=9A?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=82=92=E3=83=86=E3=83=B3=E3=83=97=E3=83=AC?= =?UTF-8?q?=E3=83=BC=E3=83=88=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ohana, calendar_management, cyber_ace_1on1, nomad_japan, activity_bookings, goal_dashboard, emp_track_extension, raycast-extensions 等で繰り返し使われている 設定ファイルを config リポジトリのテンプレートとして共通化する。 - Prettier: base (80) / wide (120) の2パターン + prettierignore - lint-staged: ESLint+Prettier / Biome / Prettier-only の3パターン - Husky hooks: pre-commit, commit-msg, pre-push のベーステンプレート - E2E Playwright CI ジョブテンプレート (workflow_call 対応) - Claude Code ワークフローテンプレート (Bot 除外ロジック統一) Co-Authored-By: Claude Opus 4.6 (1M context) --- templates/README.md | 33 +++++-- templates/husky/commit-msg | 3 + templates/husky/pre-commit | 9 ++ templates/husky/pre-push | 26 ++++++ templates/lintstagedrc-biome.json | 4 + templates/lintstagedrc-eslint.json | 5 ++ templates/lintstagedrc-prettier-only.json | 3 + templates/prettierignore | 34 ++++++++ templates/prettierrc-base.json | 28 ++++++ templates/prettierrc-wide.json | 26 ++++++ templates/workflows/claude.yml | 96 +++++++++++++++++++++ templates/workflows/e2e-playwright.yml | 100 ++++++++++++++++++++++ 12 files changed, 361 insertions(+), 6 deletions(-) create mode 100644 templates/husky/commit-msg create mode 100644 templates/husky/pre-commit create mode 100644 templates/husky/pre-push create mode 100644 templates/lintstagedrc-biome.json create mode 100644 templates/lintstagedrc-eslint.json create mode 100644 templates/lintstagedrc-prettier-only.json create mode 100644 templates/prettierignore create mode 100644 templates/prettierrc-base.json create mode 100644 templates/prettierrc-wide.json create mode 100644 templates/workflows/claude.yml create mode 100644 templates/workflows/e2e-playwright.yml diff --git a/templates/README.md b/templates/README.md index b5f8d5ee..b808be17 100644 --- a/templates/README.md +++ b/templates/README.md @@ -6,12 +6,14 @@ ### ワークフロー(`workflows/`) -| テンプレート | 対象 | 自動適用条件 | -| --------------------------- | ------------------------------- | -------------------------------- | -| `dependabot-auto-merge.yml` | Dependabot を使う全プロジェクト | dependabot.yml が存在する場合 | -| `label-sync.yml` | 全プロジェクト | 常に推奨 | -| `stale.yml` | Issue/PR が多いプロジェクト | 常に推奨 | -| `terraform-drift.yml` | Terraform プロジェクト | Terraform ファイルが存在する場合 | +| テンプレート | 対象 | 自動適用条件 | +| --------------------------- | ------------------------------- | --------------------------------- | +| `dependabot-auto-merge.yml` | Dependabot を使う全プロジェクト | dependabot.yml が存在する場合 | +| `label-sync.yml` | 全プロジェクト | 常に推奨 | +| `stale.yml` | Issue/PR が多いプロジェクト | 常に推奨 | +| `terraform-drift.yml` | Terraform プロジェクト | Terraform ファイルが存在する場合 | +| `e2e-playwright.yml` | Playwright E2E テスト | test:e2e スクリプトが存在する場合 | +| `claude.yml` | Claude Code 連携 | 常に推奨 | ### pre-commit(`pre-commit-config-*.yaml`) @@ -34,6 +36,25 @@ | `SECURITY.md` | セキュリティポリシー | 中 | | `CONTRIBUTING.md` | コントリビューションガイド | 低 | +### コードスタイル(Prettier / lint-staged) + +| テンプレート | いつ使う | +| --------------------------------- | ---------------------------------------------------- | +| `prettierrc-base.json` | **標準**: printWidth 80、arrowParens "avoid" | +| `prettierrc-wide.json` | **ワイド**: printWidth 120、arrowParens "always" | +| `prettierignore` | **全プロジェクト**: 共通の除外パターン | +| `lintstagedrc-eslint.json` | **ESLint + Prettier**: lint + format on staged files | +| `lintstagedrc-biome.json` | **Biome**: check + format on staged files | +| `lintstagedrc-prettier-only.json` | **Prettier のみ**: format on staged files | + +### Git Hooks(`husky/`) + +| テンプレート | 内容 | +| ------------ | --------------------------------------------------- | +| `pre-commit` | lint-staged + ファイル長チェック | +| `commit-msg` | commitlint(Conventional Commits) | +| `pre-push` | typecheck + lint + test(スクリプト存在時のみ実行) | + ### その他 | テンプレート | 対象 | diff --git a/templates/husky/commit-msg b/templates/husky/commit-msg new file mode 100644 index 00000000..f0abd676 --- /dev/null +++ b/templates/husky/commit-msg @@ -0,0 +1,3 @@ +#!/bin/sh + +npx --no -- commitlint --edit "$1" diff --git a/templates/husky/pre-commit b/templates/husky/pre-commit new file mode 100644 index 00000000..9979f130 --- /dev/null +++ b/templates/husky/pre-commit @@ -0,0 +1,9 @@ +#!/bin/sh + +# lint-staged: フォーマット・リント +npx lint-staged || exit 1 + +# ファイル長チェック(script/check-file-length.sh が存在する場合のみ) +if [ -f script/check-file-length.sh ]; then + bash script/check-file-length.sh || exit 1 +fi diff --git a/templates/husky/pre-push b/templates/husky/pre-push new file mode 100644 index 00000000..b0e89e54 --- /dev/null +++ b/templates/husky/pre-push @@ -0,0 +1,26 @@ +#!/bin/sh + +echo "Pre-push checks..." + +# TypeScript 型チェック(typecheck スクリプトが存在する場合) +if npm run --silent typecheck --if-present 2>/dev/null; then + echo "-> TypeScript check passed" +else + echo "TypeScript check failed"; exit 1 +fi + +# Lint +if npm run --silent lint --if-present 2>/dev/null; then + echo "-> Lint passed" +else + echo "Lint failed"; exit 1 +fi + +# テスト +if npm run --silent test -- --ci --passWithNoTests 2>/dev/null; then + echo "-> Tests passed" +else + echo "Tests failed"; exit 1 +fi + +echo "All pre-push checks passed" diff --git a/templates/lintstagedrc-biome.json b/templates/lintstagedrc-biome.json new file mode 100644 index 00000000..22a524bc --- /dev/null +++ b/templates/lintstagedrc-biome.json @@ -0,0 +1,4 @@ +{ + "*.{ts,tsx,js,jsx}": ["biome check --fix --no-errors-on-unmatched"], + "*.{json,md}": ["biome format --write --no-errors-on-unmatched"] +} diff --git a/templates/lintstagedrc-eslint.json b/templates/lintstagedrc-eslint.json new file mode 100644 index 00000000..af752ac7 --- /dev/null +++ b/templates/lintstagedrc-eslint.json @@ -0,0 +1,5 @@ +{ + "*.{ts,tsx}": ["eslint --fix", "prettier --write"], + "*.{js,jsx,mjs,cjs}": ["eslint --fix", "prettier --write"], + "*.{json,css,md,yml,yaml}": ["prettier --write"] +} diff --git a/templates/lintstagedrc-prettier-only.json b/templates/lintstagedrc-prettier-only.json new file mode 100644 index 00000000..716db8dc --- /dev/null +++ b/templates/lintstagedrc-prettier-only.json @@ -0,0 +1,3 @@ +{ + "*.{js,jsx,ts,tsx,md,json,yaml,yml}": ["prettier --write"] +} diff --git a/templates/prettierignore b/templates/prettierignore new file mode 100644 index 00000000..662c7eba --- /dev/null +++ b/templates/prettierignore @@ -0,0 +1,34 @@ +# Dependencies +node_modules/ + +# Build outputs +.next/ +out/ +dist/ +build/ +coverage/ + +# Lock files +package-lock.json +pnpm-lock.yaml +yarn.lock + +# Environment +.env +.env.* + +# IDE / OS +.vscode/ +.idea/ +.DS_Store + +# Claude Code +.claude/settings.local.json + +# Terraform +*.tfstate +*.tfstate.* +.terraform/ + +# Supabase +supabase/.temp/ diff --git a/templates/prettierrc-base.json b/templates/prettierrc-base.json new file mode 100644 index 00000000..b7e4e9d9 --- /dev/null +++ b/templates/prettierrc-base.json @@ -0,0 +1,28 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "useTabs": false, + "trailingComma": "all", + "printWidth": 80, + "endOfLine": "lf", + "arrowParens": "avoid", + "bracketSpacing": true, + "bracketSameLine": false, + "quoteProps": "as-needed", + "jsxSingleQuote": true, + "overrides": [ + { + "files": "*.json", + "options": { + "singleQuote": false + } + }, + { + "files": "*.md", + "options": { + "proseWrap": "preserve" + } + } + ] +} diff --git a/templates/prettierrc-wide.json b/templates/prettierrc-wide.json new file mode 100644 index 00000000..3508d0c1 --- /dev/null +++ b/templates/prettierrc-wide.json @@ -0,0 +1,26 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "useTabs": false, + "trailingComma": "all", + "printWidth": 120, + "endOfLine": "lf", + "arrowParens": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "overrides": [ + { + "files": "*.json", + "options": { + "singleQuote": false + } + }, + { + "files": "*.md", + "options": { + "proseWrap": "preserve" + } + } + ] +} diff --git a/templates/workflows/claude.yml b/templates/workflows/claude.yml new file mode 100644 index 00000000..662ab143 --- /dev/null +++ b/templates/workflows/claude.yml @@ -0,0 +1,96 @@ +# Claude Code ワークフロー +# +# Issue や PR で @claude をメンションすると Claude Code が応答する。 +# Bot からのイベントは自動除外、Draft PR も除外。 +# +# 使い方: +# .github/workflows/claude.yml にコピーして配置 +# リポジトリ Secret に CLAUDE_CODE_OAUTH_TOKEN を設定 +# +# カスタマイズ: +# - timeout-minutes: タイムアウト(デフォルト: 20分) +# - allowed_tools: Claude に許可するツール +# - claude_args: 追加の system prompt 等 +# +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened] + pull_request_review: + types: [submitted] + +permissions: {} + +concurrency: + # イベント種別 + トリガーのコメント/レビューIDを含めることで、 + # 同一 PR/Issue 内でも異なるメンションが互いをキャンセルしない + group: >- + claude-${{ github.repository }}-${{ + github.event.issue.number + || github.event.pull_request.number + || github.run_id + }}-${{ + github.event.comment.id + || github.event.review.id + || github.run_id + }} + cancel-in-progress: false + +jobs: + claude: + # Bot 全般を除外(sender.type で判定するため Bot 名のハードコードが不要) + if: | + github.event.sender.type != 'Bot' && + ( + (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', '@claude') && + !(github.event.issue.pull_request && github.event.issue.pull_request.url && github.event.issue.draft == true)) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body || '', '@claude') && + github.event.pull_request.draft == false) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body || '', '@claude') && + github.event.pull_request.draft == false) || + (github.event_name == 'issues' && (contains(github.event.issue.body || '', '@claude') || contains(github.event.issue.title || '', '@claude'))) + ) + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + checks: read + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@6e2bd52842c65e914eba5c8badd17560bd26b5de # v1.0.89 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + additional_permissions: | + actions: read + checks: read + + settings: | + { + "permissions": { + "allowedTools": [ + "Bash(gh:*)", + "Bash(npm:*)", + "Bash(pnpm:*)", + "Bash(npx:*)" + ] + } + } + + claude_args: | + --system-prompt "When working on GitHub Issues (not PRs), after completing all code changes and pushing to a branch, you MUST create a Pull Request by running 'gh pr create' command. Do not just provide a link - actually execute the gh pr create command to create the PR automatically." diff --git a/templates/workflows/e2e-playwright.yml b/templates/workflows/e2e-playwright.yml new file mode 100644 index 00000000..c1053471 --- /dev/null +++ b/templates/workflows/e2e-playwright.yml @@ -0,0 +1,100 @@ +# E2E Playwright テストワークフロー +# +# Playwright を使った E2E テストを実行する再利用可能ワークフロー。 +# Next.js アプリケーションのビルド → Playwright テスト → レポートアップロード。 +# +# 使い方: +# .github/workflows/e2e-playwright.yml にコピーして配置 +# package.json に test:e2e スクリプトを定義 +# +# カスタマイズ: +# - NODE_VERSION: Node.js バージョン(デフォルト: 22) +# - PACKAGE_MANAGER: npm / pnpm(デフォルト: npm) +# - PLAYWRIGHT_VERSION: Playwright コンテナバージョン +# - E2E_COMMAND: テスト実行コマンド +# - WORKING_DIRECTORY: アプリケーションのルート +# +name: E2E Tests + +on: + workflow_call: + inputs: + node-version: + description: 'Node.js version' + type: string + default: '22' + package-manager: + description: 'Package manager (npm or pnpm)' + type: string + default: 'npm' + e2e-command: + description: 'E2E test command' + type: string + default: 'npm run test:e2e' + working-directory: + description: 'Working directory for the app' + type: string + default: '.' + build-command: + description: 'Build command (empty to skip)' + type: string + default: 'npm run build' + +# スタンドアロンで使う場合はこちらを有効化 +# on: +# push: +# branches: [main] +# pull_request: +# branches: [main] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-e2e-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + e2e: + runs-on: ubuntu-latest + timeout-minutes: 30 + defaults: + run: + working-directory: ${{ inputs.working-directory || '.' }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + if: inputs.package-manager == 'pnpm' + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version || '22' }} + cache: ${{ inputs.package-manager || 'npm' }} + + - name: Install dependencies + run: ${{ inputs.package-manager == 'pnpm' && 'pnpm install --frozen-lockfile' || 'npm ci' }} + + - name: Build + if: inputs.build-command != '' + run: ${{ inputs.build-command || 'npm run build' }} + + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium + + - name: Run E2E tests + run: ${{ inputs.e2e-command || 'npm run test:e2e' }} + + - name: Upload Playwright report + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: | + ${{ inputs.working-directory || '.' }}/playwright-report/ + ${{ inputs.working-directory || '.' }}/test-results/ + retention-days: 14 From a9a8294fe8a14a518100047c057a7b26826a69ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 7 Apr 2026 15:52:19 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E3=82=B3=E3=83=BC=E3=83=89=E3=83=AC?= =?UTF-8?q?=E3=83=93=E3=83=A5=E3=83=BC=E6=8C=87=E6=91=98=E4=BA=8B=E9=A0=85?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prettierrc-wide.json に jsxSingleQuote / quoteProps を明示追加 - husky/pre-push の --silent を除去し --if-present のコメントを明確化 - e2e-playwright.yml の actions を SHA ピン留めに統一 - e2e-playwright.yml のスタンドアロン用コメントを明確化 - husky テンプレートに実行権限を付与 Co-Authored-By: Claude Opus 4.6 (1M context) --- templates/husky/commit-msg | 0 templates/husky/pre-commit | 0 templates/husky/pre-push | 12 ++++++------ templates/prettierrc-wide.json | 2 ++ templates/workflows/e2e-playwright.yml | 11 +++++------ 5 files changed, 13 insertions(+), 12 deletions(-) mode change 100644 => 100755 templates/husky/commit-msg mode change 100644 => 100755 templates/husky/pre-commit mode change 100644 => 100755 templates/husky/pre-push diff --git a/templates/husky/commit-msg b/templates/husky/commit-msg old mode 100644 new mode 100755 diff --git a/templates/husky/pre-commit b/templates/husky/pre-commit old mode 100644 new mode 100755 diff --git a/templates/husky/pre-push b/templates/husky/pre-push old mode 100644 new mode 100755 index b0e89e54..8a5f0b45 --- a/templates/husky/pre-push +++ b/templates/husky/pre-push @@ -2,22 +2,22 @@ echo "Pre-push checks..." -# TypeScript 型チェック(typecheck スクリプトが存在する場合) -if npm run --silent typecheck --if-present 2>/dev/null; then +# TypeScript 型チェック(スクリプト未定義時はスキップ) +if npm run typecheck --if-present 2>/dev/null; then echo "-> TypeScript check passed" else echo "TypeScript check failed"; exit 1 fi -# Lint -if npm run --silent lint --if-present 2>/dev/null; then +# Lint(スクリプト未定義時はスキップ) +if npm run lint --if-present 2>/dev/null; then echo "-> Lint passed" else echo "Lint failed"; exit 1 fi -# テスト -if npm run --silent test -- --ci --passWithNoTests 2>/dev/null; then +# テスト(スクリプト未定義時はスキップ) +if npm run test --if-present -- --ci --passWithNoTests 2>/dev/null; then echo "-> Tests passed" else echo "Tests failed"; exit 1 diff --git a/templates/prettierrc-wide.json b/templates/prettierrc-wide.json index 3508d0c1..e1d8bc22 100644 --- a/templates/prettierrc-wide.json +++ b/templates/prettierrc-wide.json @@ -9,6 +9,8 @@ "arrowParens": "always", "bracketSpacing": true, "bracketSameLine": false, + "quoteProps": "as-needed", + "jsxSingleQuote": false, "overrides": [ { "files": "*.json", diff --git a/templates/workflows/e2e-playwright.yml b/templates/workflows/e2e-playwright.yml index c1053471..d14c6f9f 100644 --- a/templates/workflows/e2e-playwright.yml +++ b/templates/workflows/e2e-playwright.yml @@ -40,8 +40,7 @@ on: type: string default: 'npm run build' -# スタンドアロンで使う場合はこちらを有効化 -# on: +# スタンドアロンで使う場合は上記 workflow_call を以下に置き換える: # push: # branches: [main] # pull_request: @@ -64,14 +63,14 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Setup pnpm if: inputs.package-manager == 'pnpm' - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@a7487c7e89a18df77bdb2544e188270c5d72bfce # v4 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: ${{ inputs.node-version || '22' }} cache: ${{ inputs.package-manager || 'npm' }} @@ -91,7 +90,7 @@ jobs: - name: Upload Playwright report if: ${{ !cancelled() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: playwright-report path: | From ff23440710b71dd43fd0f21648a12f849a67c116 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 09:13:24 +0000 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E3=82=B3=E3=83=BC=E3=83=89=E3=83=AC?= =?UTF-8?q?=E3=83=93=E3=83=A5=E3=83=BC=E6=8C=87=E6=91=98=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=EF=BC=88YAML=20=E3=83=91=E3=82=BF=E3=83=BC=E3=83=B3?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=83=BBclaude.yml=20=E6=94=B9=E5=96=84?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - lintstagedrc-biome.json: YAML/YML ファイルの prettier 処理を追加 - claude.yml: issue_comment での無効な Draft PR 判定を削除(github.event.issue.draft は存在しない) - claude.yml: allowedTools に Bash(git:*) を追加(システムプロンプトが git push を必要とするため) Co-authored-by: keito4 --- templates/lintstagedrc-biome.json | 3 ++- templates/workflows/claude.yml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/lintstagedrc-biome.json b/templates/lintstagedrc-biome.json index 22a524bc..a4125135 100644 --- a/templates/lintstagedrc-biome.json +++ b/templates/lintstagedrc-biome.json @@ -1,4 +1,5 @@ { "*.{ts,tsx,js,jsx}": ["biome check --fix --no-errors-on-unmatched"], - "*.{json,md}": ["biome format --write --no-errors-on-unmatched"] + "*.{json,md}": ["biome format --write --no-errors-on-unmatched"], + "*.{yaml,yml}": ["prettier --write"] } diff --git a/templates/workflows/claude.yml b/templates/workflows/claude.yml index 662ab143..1bd941d8 100644 --- a/templates/workflows/claude.yml +++ b/templates/workflows/claude.yml @@ -47,8 +47,7 @@ jobs: if: | github.event.sender.type != 'Bot' && ( - (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', '@claude') && - !(github.event.issue.pull_request && github.event.issue.pull_request.url && github.event.issue.draft == true)) || + (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body || '', '@claude') && github.event.pull_request.draft == false) || (github.event_name == 'pull_request_review' && contains(github.event.review.body || '', '@claude') && @@ -85,6 +84,7 @@ jobs: "permissions": { "allowedTools": [ "Bash(gh:*)", + "Bash(git:*)", "Bash(npm:*)", "Bash(pnpm:*)", "Bash(npx:*)" From dc56f63af4076e1570f78b53826a23b4f7b78a90 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 12:09:10 +0000 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20pre-push=20=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88=E3=83=95=E3=83=A9=E3=82=B0=E6=B1=8E=E7=94=A8=E5=8C=96?= =?UTF-8?q?=E3=83=BBclaude.yml=20=E3=82=BB=E3=82=AD=E3=83=A5=E3=83=AA?= =?UTF-8?q?=E3=83=86=E3=82=A3=E5=BC=B7=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - templates/husky/pre-push: Jest固有フラグ(--ci --passWithNoTests)を除去し 汎用的な `npm run --if-present test` に変更 - templates/workflows/claude.yml: ヘッダーコメントを実態に合わせて修正 (issue_commentではDraft判定不可の旨を明記) - templates/workflows/claude.yml: OWNER/MEMBER/COLLABORATORのみ@claudeを 実行可能にする author_association チェックを追加(セキュリティ強化) Co-authored-by: keito4 --- templates/husky/pre-push | 2 +- templates/workflows/claude.yml | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/husky/pre-push b/templates/husky/pre-push index 8a5f0b45..762f9a94 100755 --- a/templates/husky/pre-push +++ b/templates/husky/pre-push @@ -17,7 +17,7 @@ else fi # テスト(スクリプト未定義時はスキップ) -if npm run test --if-present -- --ci --passWithNoTests 2>/dev/null; then +if npm run --if-present test 2>/dev/null; then echo "-> Tests passed" else echo "Tests failed"; exit 1 diff --git a/templates/workflows/claude.yml b/templates/workflows/claude.yml index 1bd941d8..7c04259d 100644 --- a/templates/workflows/claude.yml +++ b/templates/workflows/claude.yml @@ -1,7 +1,9 @@ # Claude Code ワークフロー # # Issue や PR で @claude をメンションすると Claude Code が応答する。 -# Bot からのイベントは自動除外、Draft PR も除外。 +# Bot からのイベントは自動除外。 +# PR イベント(pull_request_review_comment / pull_request_review)では Draft PR も除外。 +# issue_comment イベントでは Draft 判定不可のため除外なし。 # # 使い方: # .github/workflows/claude.yml にコピーして配置 @@ -43,9 +45,15 @@ concurrency: jobs: claude: - # Bot 全般を除外(sender.type で判定するため Bot 名のハードコードが不要) + # Bot 全般を除外し、信頼済み Association のみ許可 + # OWNER / MEMBER / COLLABORATOR: リポジトリ管理者・チームメンバー・招待コラボレーター if: | github.event.sender.type != 'Bot' && + contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), + github.event.comment.author_association || + github.event.review.author_association || + github.event.issue.author_association + ) && ( (github.event_name == 'issue_comment' && contains(github.event.comment.body || '', '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body || '', '@claude') && From 5a44c79bde66bec7668e975ad278060750092a96 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:15:09 +0000 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20lintstagedrc-prettier-only=20?= =?UTF-8?q?=E3=81=AB=20css=20=E3=83=91=E3=82=BF=E3=83=BC=E3=83=B3=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lintstagedrc-eslint.json と整合させ css ファイルも Prettier フォーマット対象に追加。 CI paths filter (.json) にマッチさせ Quality Gate チェックを再トリガー。 Co-authored-by: keito4 --- templates/lintstagedrc-prettier-only.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/lintstagedrc-prettier-only.json b/templates/lintstagedrc-prettier-only.json index 716db8dc..deecafba 100644 --- a/templates/lintstagedrc-prettier-only.json +++ b/templates/lintstagedrc-prettier-only.json @@ -1,3 +1,3 @@ { - "*.{js,jsx,ts,tsx,md,json,yaml,yml}": ["prettier --write"] + "*.{js,jsx,ts,tsx,css,md,json,yaml,yml}": ["prettier --write"] } From 954ba0d59d83df2d0a61f3d5cc9345eb060a914f Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 03:07:44 +0000 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20pre-push=20=E3=83=95=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E3=82=92=E5=BE=A9=E5=85=83=EF=BC=882>/dev/null=20=E3=82=92?= =?UTF-8?q?=E9=99=A4=E5=8E=BB=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit エラー発生時に診断情報が見えるよう stderr 抑制を除去。 Co-authored-by: keito4 --- templates/husky/pre-push | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/husky/pre-push b/templates/husky/pre-push index 762f9a94..4f772d93 100755 --- a/templates/husky/pre-push +++ b/templates/husky/pre-push @@ -3,21 +3,21 @@ echo "Pre-push checks..." # TypeScript 型チェック(スクリプト未定義時はスキップ) -if npm run typecheck --if-present 2>/dev/null; then +if npm run typecheck --if-present; then echo "-> TypeScript check passed" else echo "TypeScript check failed"; exit 1 fi # Lint(スクリプト未定義時はスキップ) -if npm run lint --if-present 2>/dev/null; then +if npm run lint --if-present; then echo "-> Lint passed" else echo "Lint failed"; exit 1 fi # テスト(スクリプト未定義時はスキップ) -if npm run --if-present test 2>/dev/null; then +if npm run --if-present test; then echo "-> Tests passed" else echo "Tests failed"; exit 1