Skip to content

Commit 7290e10

Browse files
constkclaude
andauthored
chore: PR title lint + release-drafter (#12) (#52)
Adds the second half of #12 (release-drafter); pr-title.yml itself shipped in #10's bundle. Port .github/workflows/release-drafter.yml + the categories / autolabeler / version-resolver config in .github/release-drafter.yml verbatim from Teller. Pin release-drafter@v6 to commit SHA 6a93d829.... release-drafter is exempt from required-status-checks (workflow runs on push to main + PR label events; never on every PR). Already in EXEMPT_WORKFLOWS in check_required_contexts.py. Closes #12 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fa459c2 commit 7290e10

2 files changed

Lines changed: 113 additions & 0 deletions

File tree

.github/release-drafter.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Release-drafter configuration.
2+
#
3+
# Drafts release notes by reading the conventional-commit prefix of each
4+
# merged PR title (squash-merge subject) and grouping into the categories
5+
# below. Categories map 1:1 to the [tool.commitizen].customize.schema_pattern
6+
# types enforced by `Lint PR title` CI; see check_commit_types.py.
7+
8+
name-template: "v$RESOLVED_VERSION"
9+
tag-template: "v$RESOLVED_VERSION"
10+
11+
categories:
12+
- title: "Features"
13+
labels:
14+
- "feat"
15+
- title: "Fixes"
16+
labels:
17+
- "fix"
18+
- title: "Housekeeping"
19+
labels:
20+
- "chore"
21+
- "docs"
22+
- "refactor"
23+
- "test"
24+
- "release"
25+
26+
# Match conventional-commit prefixes against PR titles regardless of label —
27+
# release-drafter assigns the synthetic label so the categories above resolve
28+
# even when the PR doesn't carry a manual label.
29+
autolabeler:
30+
- label: "feat"
31+
title:
32+
- "/^feat(\\(.+\\))?:/i"
33+
- label: "fix"
34+
title:
35+
- "/^fix(\\(.+\\))?:/i"
36+
- label: "chore"
37+
title:
38+
- "/^chore(\\(.+\\))?:/i"
39+
- label: "docs"
40+
title:
41+
- "/^docs(\\(.+\\))?:/i"
42+
- label: "refactor"
43+
title:
44+
- "/^refactor(\\(.+\\))?:/i"
45+
- label: "test"
46+
title:
47+
- "/^test(\\(.+\\))?:/i"
48+
- label: "release"
49+
title:
50+
- "/^release(\\(.+\\))?:/i"
51+
52+
# SemVer resolver:
53+
# - any `feat` PR since the last release → minor bump
54+
# - any `fix` PR with no `feat` → patch bump
55+
# - everything else (chore/docs/refactor/test/release-only) → patch bump
56+
# `major` is not auto-resolved — major bumps are deliberate human calls.
57+
version-resolver:
58+
minor:
59+
labels:
60+
- "feat"
61+
patch:
62+
labels:
63+
- "fix"
64+
- "chore"
65+
- "docs"
66+
- "refactor"
67+
- "test"
68+
- "release"
69+
default: patch
70+
71+
template: |
72+
## What's changed in v$RESOLVED_VERSION
73+
74+
$CHANGES
75+
76+
**Full changelog:** https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
77+
78+
change-template: "- $TITLE ([#$NUMBER]($URL))"
79+
change-title-escapes: '\<*_&' # escape markdown control chars in PR titles
80+
81+
exclude-labels:
82+
- "skip-changelog"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release Drafter
2+
3+
# Updates a draft GitHub Release on every push to `main` and on PR
4+
# label / open / reopen events. The drafted release body becomes the
5+
# `release.yml` workflow's input on tag push (see release.yml).
6+
#
7+
# Single-source-of-truth: the categories + version-resolver in
8+
# .github/release-drafter.yml mirror the conventional-commit prefixes
9+
# enforced by check_commit_types.py and the `Lint PR title` job.
10+
11+
on:
12+
push:
13+
branches: [main]
14+
pull_request:
15+
types: [opened, reopened, synchronize, labeled, unlabeled]
16+
branches: [main]
17+
18+
permissions:
19+
contents: write # create/update draft releases
20+
pull-requests: read
21+
22+
jobs:
23+
draft:
24+
runs-on: ubuntu-latest
25+
name: Draft next release
26+
steps:
27+
- uses: release-drafter/release-drafter@6a93d829887aa2e0748befe2e808c66c0ec6e4c7 # v6
28+
with:
29+
config-name: release-drafter.yml
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)