|
| 1 | +--- |
| 2 | +name: pr-scope-rules |
| 3 | +description: PR scope validation rules for this project. Use this rule when creating commit messages and PR titles to ensure proper scope validation. |
| 4 | +--- |
| 5 | + |
| 6 | +# PR Scope Rules |
| 7 | + |
| 8 | +このプロジェクトでは、PR タイトルにスコープを含める必要があります。GitHub Actions の `.github/workflows/check_pr_scope.yml` ワークフローが `scripts/check_pr_scope.sh` スクリプトを使用して自動的に検証します。 |
| 9 | + |
| 10 | +## PR タイトルの形式 |
| 11 | + |
| 12 | +PR タイトルは以下の形式に従ってください: |
| 13 | + |
| 14 | +```text |
| 15 | +type(scope1,scope2): message |
| 16 | +``` |
| 17 | + |
| 18 | +**必須要素:** |
| 19 | + |
| 20 | +- `type`: コミットタイプ(`feat`, `fix`, `docs`, `refactor`, `test`, `chore` など) |
| 21 | +- `(scope1,scope2)`: カンマ区切りのスコープ(必須) |
| 22 | +- `:` + スペース: コロンとスペース |
| 23 | +- `message`: PR の説明 |
| 24 | + |
| 25 | +## コミットタイプ(type)のガイド |
| 26 | + |
| 27 | +Conventional Commits に基づいたコミットタイプを使用してください。以下は一般的なタイプとその使用例です: |
| 28 | + |
| 29 | +### 主要なタイプ |
| 30 | + |
| 31 | +- **`feat`**: 新機能の追加 |
| 32 | + - 例: `feat(zsh): add new alias for git commands` |
| 33 | + - 例: `feat(brew): add new package management tool` |
| 34 | + |
| 35 | +- **`fix`**: バグ修正 |
| 36 | + - 例: `fix(ansible): correct path configuration error` |
| 37 | + - 例: `fix(github): resolve workflow syntax error` |
| 38 | + |
| 39 | +- **`docs`**: ドキュメントのみの変更 |
| 40 | + - 例: `docs(*): update README with setup instructions` |
| 41 | + - 例: `docs(zsh): add comments to configuration file` |
| 42 | + |
| 43 | +- **`refactor`**: リファクタリング(機能追加もバグ修正もないコードの改善) |
| 44 | + - 例: `refactor(scripts): reorganize command structure` |
| 45 | + - 例: `refactor(brew): simplify package validation logic` |
| 46 | + |
| 47 | +- **`test`**: テストの追加・変更 |
| 48 | + - 例: `test(dofy): add unit tests for brew module` |
| 49 | + - 例: `test(ansible): update integration test cases` |
| 50 | + |
| 51 | +- **`chore`**: ビルドプロセスやツールの変更(依存関係の更新、設定ファイルの変更など) |
| 52 | + - 例: `chore(*): update dependencies` |
| 53 | + - 例: `chore(github): update CI workflow configuration` |
| 54 | + |
| 55 | +### その他のタイプ |
| 56 | + |
| 57 | +- **`style`**: コードの動作に影響しない変更(フォーマット、空白の調整など) |
| 58 | + - 例: `style(scripts): fix code formatting` |
| 59 | + |
| 60 | +- **`perf`**: パフォーマンス改善 |
| 61 | + - 例: `perf(brew): optimize package list generation` |
| 62 | + |
| 63 | +- **`ci`**: CI設定の変更 |
| 64 | + - 例: `ci(github): add new workflow for validation` |
| 65 | + |
| 66 | +### タイプの選択指針 |
| 67 | + |
| 68 | +1. **新機能を追加する場合** → `feat` |
| 69 | +2. **バグを修正する場合** → `fix` |
| 70 | +3. **ドキュメントのみ変更する場合** → `docs` |
| 71 | +4. **コードを改善するが機能追加・修正ではない場合** → `refactor` |
| 72 | +5. **テスト関連の変更** → `test` |
| 73 | +6. **ツールや設定の変更** → `chore` |
| 74 | + |
| 75 | +### 特別なスコープ |
| 76 | + |
| 77 | +すべての変更を許可する場合は、以下のスコープを使用できます: |
| 78 | + |
| 79 | +```text |
| 80 | +type(*): message |
| 81 | +``` |
| 82 | + |
| 83 | +このスコープを使用すると、変更されたファイルに関係なく、すべての変更が許可されます。 |
| 84 | + |
| 85 | +## スコープの決定ルール |
| 86 | + |
| 87 | +`scope-rules.json` に定義されたルールに基づいて、変更されたファイルのパスから必要なスコープが自動的に決定されます: |
| 88 | + |
| 89 | +1. **`^config/([^/]+)/.*`** → スコープは `$1`(例: `config/zsh/...` → `zsh`) |
| 90 | +2. **`^scripts/([^/]+)/.*`** → スコープは `$1`(例: `scripts/ansible/...` → `ansible`) |
| 91 | +3. **`^data/([^/]+)/.*`** → スコープは `$1`(例: `data/brew/...` → `brew`) |
| 92 | +4. **`^\\.github/.*`** → スコープは `github` |
| 93 | +5. **`.*`** (その他のファイル) → スコープは `dotfiles` |
| 94 | + |
| 95 | +**重要:** ルールは上から順に評価され、最初にマッチしたルールが適用されます。 |
| 96 | + |
| 97 | +## 複数スコープの指定 |
| 98 | + |
| 99 | +複数のディレクトリにまたがって変更する場合は、カンマ区切りで複数のスコープを指定してください: |
| 100 | + |
| 101 | +```text |
| 102 | +feat(zsh,brew): update configurations |
| 103 | +``` |
| 104 | + |
| 105 | +PR タイトルのスコープは、変更されたすべてのファイルに必要なスコープを**すべて**カバーしている必要があります。 |
0 commit comments