Skip to content

Commit ac7d94b

Browse files
ci: fix PR title check for acronyms and fork PRs (#88)
- Switch trigger from pull_request to pull_request_target so the check can write PR labels on fork-originated PRs (safe because this workflow only reads the PR title, never checks out fork code) - Relax subjectPattern to allow all-caps acronyms (SHA, API, URL) while still blocking Title Case starts (Add, Update) - Add revert and build to CONTRIBUTING.md valid types list - Document subject casing rule and PR title enforcement in CONTRIBUTING.md
1 parent 98a8789 commit ac7d94b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/pr-title.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: PR Title Lint
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, edited, synchronize, reopened]
66
branches: [main]
77

@@ -31,15 +31,18 @@ jobs:
3131
revert
3232
build
3333
requireScope: false
34-
subjectPattern: ^[a-z].+$
34+
subjectPattern: ^(?![A-Z][a-z]).+$
3535
subjectPatternError: |
36-
The subject must start with a lowercase letter.
36+
The subject must not start with a Title Case word (e.g. "Add", "Update").
37+
Acronyms like SHA, API, URL are fine. Lowercase starts are fine.
3738
3839
Examples of valid PR titles:
3940
feat(docx-core): add paragraph diffing
4041
fix: correct bookmark cleanup order
4142
chore(release): bump workspace versions
4243
ci: add PR title validation
44+
ci: SHA-pin all GitHub Actions
45+
feat: API migration to v2
4346
4447
auto-label:
4548
name: Apply type label from PR title

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Longer is better — think essay, not tweet.
4646
Fixes: #42
4747
```
4848

49-
**Valid types:** `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `ci`, `perf`, `style`
49+
**Valid types:** `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `ci`, `perf`, `style`, `revert`, `build`
5050

5151
**Scopes** should match the package or area you're changing:
5252
- `fix(docx-core):` — bug fix in the core OOXML library
@@ -56,10 +56,14 @@ Fixes: #42
5656

5757
Scope your commits to one package when possible. Cross-package changes should use the primary package as scope.
5858

59+
**Subject casing:** The subject (the part after the colon) must not start with a Title Case word like "Add" or "Update". Lowercase starts and all-caps acronyms (SHA, API, URL) are fine.
60+
5961
**Reference issues** in the commit body: `Fixes: #N` (closes the issue) or `Ref: #N` (related but doesn't close).
6062

6163
## Pull Request Guidelines
6264

65+
Pull request titles follow the same Conventional Commits format as commit messages. A CI check (`Validate conventional title`) enforces this on every PR.
66+
6367
- **Keep PRs small and focused.** 10 small PRs are better than 1 monolithic one.
6468
- **A PR doesn't have to be done** — or even work — but it should represent clean progress in one direction.
6569
- **Decompose where possible.** For example, submit regexes + tests in one PR, then the feature that uses them in another.

0 commit comments

Comments
 (0)