Skip to content

Commit 828003b

Browse files
committed
[MNT] add auto-pr-label + -draft-changelog workflows
1 parent 3c3211d commit 828003b

File tree

4 files changed

+182
-0
lines changed

4 files changed

+182
-0
lines changed

.github/auto-label-config.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# =============================================================================
2+
# Auto-Label Configuration
3+
# =============================================================================
4+
#
5+
# Used by: auto-label-prs.yml
6+
#
7+
# OUTPUT:
8+
# PRs get labels based on:
9+
# - Title prefix: [Fix] → "Fix" label
10+
# - Changed files: docs/** → "documentation" label
11+
# - Branch name: dependabot/* → "dependencies" label
12+
#
13+
# =============================================================================
14+
15+
autolabeler:
16+
- label: 'documentation'
17+
files:
18+
- 'docs/**/*'
19+
- '*.md'
20+
branch:
21+
- '/docs?\/.+/'
22+
- label: 'Fix'
23+
title:
24+
- '/^\[Fix\]/i'
25+
- label: 'Feature'
26+
title:
27+
- '/^\[Feature\]/i'
28+
- label: 'Refactor'
29+
title:
30+
- '/^\[Refactor\]/i'
31+
- label: 'Release'
32+
title:
33+
- '/^\[Release\]/i'
34+
- label: 'Hotfix'
35+
title:
36+
- '/^\[Hotfix\]/i'
37+
- label: 'dependencies'
38+
files:
39+
- 'pyproject.toml'
40+
branch:
41+
- '/dependabot\/.+/'

.github/draft-changelog-config.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# =============================================================================
2+
# Draft Changelog Configuration
3+
# =============================================================================
4+
#
5+
# Used by: draft-changelog.yml
6+
#
7+
# OUTPUT:
8+
# A draft release in GitHub Releases containing:
9+
# - Title: v5.1.0 (based on version-resolver)
10+
# - Body: Grouped list of PRs (based on categories)
11+
#
12+
# =============================================================================
13+
14+
name-template: 'v$RESOLVED_VERSION'
15+
tag-template: 'v$RESOLVED_VERSION'
16+
17+
template: |
18+
## What's Changed
19+
20+
$CHANGES
21+
22+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
23+
24+
categories:
25+
- title: 'New Features'
26+
labels:
27+
- 'Feature'
28+
- 'enhancement'
29+
- title: 'Bug Fixes'
30+
labels:
31+
- 'Fix'
32+
- 'bug'
33+
- 'Hotfix'
34+
- title: 'Refactoring'
35+
labels:
36+
- 'Refactor'
37+
- 'refactoring'
38+
- title: 'Documentation'
39+
labels:
40+
- 'documentation'
41+
- 'docs'
42+
- title: 'Maintenance'
43+
labels:
44+
- 'maintenance'
45+
- 'dependencies'
46+
- 'Release'
47+
48+
version-resolver:
49+
major:
50+
labels:
51+
- 'major'
52+
- 'breaking'
53+
minor:
54+
labels:
55+
- 'minor'
56+
- 'Feature'
57+
patch:
58+
labels:
59+
- 'patch'
60+
- 'Fix'
61+
- 'Hotfix'
62+
default: patch
63+
64+
exclude-labels:
65+
- 'skip-changelog'
66+
- 'duplicate'
67+
- 'invalid'
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# =============================================================================
2+
# Auto-Label PRs
3+
# =============================================================================
4+
#
5+
# TRIGGER:
6+
# When a PR is opened or updated
7+
#
8+
# OUTPUT:
9+
# PR gets a label based on its title prefix:
10+
# - [Fix] → "Fix" label
11+
# - [Feature] → "Feature" label
12+
# - [Refactor] → "Refactor" label
13+
# - etc.
14+
#
15+
# =============================================================================
16+
17+
name: Auto-Label PRs
18+
19+
on:
20+
pull_request:
21+
types: [opened, reopened, synchronize]
22+
23+
permissions:
24+
contents: read
25+
pull-requests: write
26+
27+
jobs:
28+
add_labels:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: release-drafter/release-drafter@v6
32+
with:
33+
config-name: auto-label-config.yml
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# =============================================================================
2+
# Draft Changelog
3+
# =============================================================================
4+
#
5+
# TRIGGER:
6+
# When code is merged/pushed to main
7+
#
8+
# OUTPUT:
9+
# A draft release in GitHub Releases section containing:
10+
# - Grouped list of merged PRs (Features, Bug Fixes, etc.)
11+
# - Suggested next version number
12+
#
13+
# DOES NOT:
14+
# - Publish the release (you must click "Publish" manually)
15+
# - Create git tags
16+
# - Upload to PyPI
17+
#
18+
# =============================================================================
19+
20+
name: Draft Changelog
21+
22+
on:
23+
push:
24+
branches:
25+
- main
26+
27+
permissions:
28+
contents: read
29+
pull-requests: write
30+
31+
jobs:
32+
update_draft:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: release-drafter/release-drafter@v6
36+
with:
37+
config-name: draft-changelog-config.yml
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)