Skip to content

Commit c66c710

Browse files
committed
Add PR validation example to README
1 parent 971e77d commit c66c710

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,37 @@ patchnotes CHANGELOG.md validate --strict # fail on warnings too
280280

281281
Inside GitHub Actions, `validate` automatically emits `::error`/`::warning` annotations with file and line, so problems show up inline on the PR diff. (Force this locally with `--github`.)
282282

283+
### Example: catching a broken changelog in a PR
284+
285+
Say a teammate opens a PR with this edit to `CHANGELOG.md`:
286+
287+
```markdown
288+
## [2.1.0] - 2026/08/02
289+
290+
### Improvments
291+
- Faster parsing
292+
```
293+
294+
Two problems: the date isn't ISO 8601, and `Improvments` isn't a Keep a Changelog section (it's also misspelled). Locally, `validate` reports both with line numbers:
295+
296+
```console
297+
$ patchnotes CHANGELOG.md validate --strict
298+
[ERROR] PN101 line 3: date '2026/08/02' is not ISO 8601 (expected YYYY-MM-DD); interpreted as 2026-08-02
299+
[WARNING] PN201 line 5: unknown change type 'Improvments'; entries filed under 'Changed'
300+
CHANGELOG.md: FAIL (strict) — 1 error(s), 1 warning(s)
301+
$ echo $?
302+
1
303+
```
304+
305+
In a GitHub Actions run, the same command emits workflow annotations instead:
306+
307+
```
308+
::error file=CHANGELOG.md,line=3,title=patchnotes PN101::date '2026/08/02' is not ISO 8601 (expected YYYY-MM-DD); interpreted as 2026-08-02
309+
::warning file=CHANGELOG.md,line=5,title=patchnotes PN201::unknown change type 'Improvments'; entries filed under 'Changed'
310+
```
311+
312+
GitHub renders these as error/warning boxes pinned to lines 3 and 5 in the PR's "Files changed" tab, the check fails, and (with branch protection) the PR can't merge until the changelog is fixed. Note that lenient parsing still recovered both problems — `parse()` would happily return the release with the date read as 2026-08-02 — strict mode is what turns recovery into rejection.
313+
283314
---
284315

285316
## GitHub Actions

0 commit comments

Comments
 (0)