Commit d36ce80
YTDB-509: Add automation to prefix commits and PR titles with issue number (#621)
#### Motivation:
When working on issue-related branches, developers often forget to
include the issue number in commit messages and PR titles, making it
harder to trace changes back to their associated issues. This PR adds
automation and documentation to ensure consistent formatting across the
team, improving traceability and reducing manual effort.
#### Changes:
**Git hook** (`prepare-commit-msg` in `.githooks/` directory):
- Matches branches starting with `YTDB` prefix (case-insensitive)
followed by optional separator and numbers (e.g., `ytdb-509`,
`YTDB_123`, `ytdb509`)
- Automatically prepends `YTDB-<number>: ` to commit messages
- Normalizes output to uppercase `YTDB` with `-` separator
- Skips prefixing if the issue number already exists anywhere in the
message (case-insensitive check)
- Ignores merge, squash, and amend commits to avoid interference with
git workflows
- Handles detached HEAD state gracefully
**GitHub Action** (`.github/workflows/pr-title-prefix.yml`):
- Triggers on PR open, edit, and synchronize events targeting `develop`
branch
- Automatically prefixes PR title with `YTDB-<number>:` based on branch
name
- Skips if the issue prefix already exists in the title
(case-insensitive check)
**PR template** (`.github/pull_request_template.md`):
- Added guidance to prefix PR titles with issue number (e.g., `YTDB-123:
Your PR title`)
#### Setup:
Developers need to enable the git hook by running:
```bash
git config core.hooksPath .githooks
```
---------
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent 692e1fc commit d36ce80
File tree
3 files changed
+111
-0
lines changed- .githooks
- .github
- workflows
3 files changed
+111
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments