Skip to content

Commit aede8d3

Browse files
authored
chore: Add release notes categorization and eliminate duplication (#21)
* improve: リリースノートのカテゴリ分けと重複解消 GitHub自動生成リリースノートを活用し、以下を改善: - .github/release.yml を追加してPRラベルによるカテゴリ分けを設定 - ワークフローから手動の「What's Changed」生成を削除し重複を解消 - バイナリ名をSwiftComplexityCLIに統一 * feat: Add label management as code Address PR review feedback to manage labels as code: - Add .github/labels.yml defining all labels used in release.yml - Add .github/workflows/labels.yml for automatic label sync - Include release note categories, standard GitHub labels, and workflow labels Labels are synced automatically when labels.yml is modified on main branch. * refactor: Consolidate duplicate labels Address PR review feedback: - Merge 'feature' into 'enhancement' (single label for new features) - Merge 'fix' into 'bug' (single label for bug-related PRs) - Update release.yml categories to match simplified labels
1 parent 000816d commit aede8d3

File tree

4 files changed

+143
-37
lines changed

4 files changed

+143
-37
lines changed

.github/labels.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Label definitions for swift-complexity repository
2+
# These labels are used for:
3+
# 1. PR categorization in auto-generated release notes (.github/release.yml)
4+
# 2. Issue/PR organization
5+
#
6+
# Sync labels using: gh label sync --filename .github/labels.yml
7+
8+
# === Release Notes Categories ===
9+
# These labels determine how PRs appear in auto-generated release notes
10+
11+
- name: breaking-change
12+
color: "d93f0b"
13+
description: "Breaking changes that require migration"
14+
15+
- name: enhancement
16+
color: "a2eeef"
17+
description: "New feature or improvement"
18+
19+
- name: bug
20+
color: "d73a4a"
21+
description: "Bug report or fix"
22+
23+
- name: documentation
24+
color: "0075ca"
25+
description: "Improvements or additions to documentation"
26+
27+
- name: skip-changelog
28+
color: "ededed"
29+
description: "Exclude from release notes"
30+
31+
# === Standard GitHub Labels ===
32+
33+
- name: duplicate
34+
color: "cfd3d7"
35+
description: "This issue or pull request already exists"
36+
37+
- name: good first issue
38+
color: "7057ff"
39+
description: "Good for newcomers"
40+
41+
- name: help wanted
42+
color: "008672"
43+
description: "Extra attention is needed"
44+
45+
- name: invalid
46+
color: "e4e669"
47+
description: "This doesn't seem right"
48+
49+
- name: question
50+
color: "d876e3"
51+
description: "Further information is requested"
52+
53+
- name: wontfix
54+
color: "ffffff"
55+
description: "This will not be worked on"
56+
57+
# === Development Workflow ===
58+
59+
- name: dependencies
60+
color: "0366d6"
61+
description: "Pull requests that update a dependency file"
62+
63+
- name: ci
64+
color: "fbca04"
65+
description: "CI/CD related changes"
66+
67+
- name: refactor
68+
color: "c5def5"
69+
description: "Code refactoring without functional changes"
70+
71+
- name: test
72+
color: "bfd4f2"
73+
description: "Test improvements or additions"
74+
75+
- name: performance
76+
color: "5319e7"
77+
description: "Performance improvements"

.github/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- skip-changelog
5+
authors:
6+
- dependabot[bot]
7+
categories:
8+
- title: "Breaking Changes"
9+
labels:
10+
- breaking-change
11+
- title: "New Features"
12+
labels:
13+
- enhancement
14+
- title: "Bug Fixes"
15+
labels:
16+
- bug
17+
- title: "Documentation"
18+
labels:
19+
- documentation
20+
- title: "Other Changes"
21+
labels:
22+
- "*"

.github/workflows/labels.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Sync Labels
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/labels.yml"
9+
workflow_dispatch:
10+
11+
jobs:
12+
sync:
13+
name: Sync Labels
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Sync labels
23+
uses: EndBug/label-sync@v2
24+
with:
25+
config-file: .github/labels.yml
26+
delete-other-labels: false
27+
dry-run: false

.github/workflows/release.yml

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -221,72 +221,52 @@ jobs:
221221
merge-multiple: true
222222
path: ./artifacts
223223

224-
- name: Generate release notes
225-
id: release_notes
224+
- name: Generate release body
225+
id: release_body
226226
run: |
227227
VERSION="${{ needs.validate.outputs.version }}"
228228
229-
# Generate changelog from git commits
230-
# Get the previous tag, excluding the current release tag
231-
PREVIOUS_TAG=$(git tag --list "v*" --sort=-version:refname | grep -v "^v${VERSION}$" | head -1)
232-
233-
if [[ -n "$PREVIOUS_TAG" ]]; then
234-
COMMITS=$(git log --pretty=format:"- %s (%h)" ${PREVIOUS_TAG}..HEAD)
235-
else
236-
# No previous tags found, use recent commits
237-
COMMITS=$(git log --pretty=format:"- %s (%h)" HEAD~10..HEAD)
238-
fi
239-
240-
cat > release_notes.md << EOF
241-
## What's Changed
242-
243-
${COMMITS}
244-
229+
cat > release_body.md << EOF
245230
## Installation
246231
247232
### Download Pre-built Binary
248233
249-
1. Download the appropriate binary for your platform and architecture:
250-
- **macOS Apple Silicon (M1/M2/M3)**: \`swift-complexity-${VERSION}-macos-arm64.tar.gz\`
251-
- **macOS Intel**: \`swift-complexity-${VERSION}-macos-x86_64.tar.gz\`
252-
- **Linux x86_64**: \`swift-complexity-${VERSION}-linux-x86_64.tar.gz\`
234+
Download the appropriate binary for your platform:
235+
- **macOS Apple Silicon (M1/M2/M3)**: \`SwiftComplexityCLI-${VERSION}-macos-arm64.tar.gz\`
236+
- **macOS Intel**: \`SwiftComplexityCLI-${VERSION}-macos-x86_64.tar.gz\`
237+
- **Linux x86_64**: \`SwiftComplexityCLI-${VERSION}-linux-x86_64.tar.gz\`
253238
254-
2. Extract and install:
255-
\`\`\`bash
256-
# Extract the downloaded archive
257-
tar -xzf swift-complexity-${VERSION}-*.tar.gz
258-
cd swift-complexity-${VERSION}-*
259-
./install.sh
260-
\`\`\`
239+
\`\`\`bash
240+
tar -xzf SwiftComplexityCLI-\${VERSION}-*.tar.gz
241+
cd SwiftComplexityCLI-\${VERSION}-*
242+
./install.sh
243+
\`\`\`
261244
262245
### Build from Source
263246
264247
\`\`\`bash
265-
git clone https://github.com/\${{ github.repository }}.git
248+
git clone https://github.com/${{ github.repository }}.git
266249
cd swift-complexity
267250
git checkout v${VERSION}
268251
swift build -c release
269252
\`\`\`
270253
271254
## Verification
272255
273-
All binaries are signed and checksums are provided for verification.
274-
275256
\`\`\`bash
276-
# Verify checksum (example for macOS)
277-
shasum -a 256 -c swift-complexity-${VERSION}-*.tar.gz.sha256
257+
shasum -a 256 -c SwiftComplexityCLI-\${VERSION}-*.tar.gz.sha256
278258
\`\`\`
279259
EOF
280260
281-
echo "Generated release notes:"
282-
cat release_notes.md
261+
echo "Generated release body:"
262+
cat release_body.md
283263
284264
- name: Create release
285265
uses: softprops/action-gh-release@v2
286266
with:
287267
tag_name: v${{ needs.validate.outputs.version }}
288268
name: v${{ needs.validate.outputs.version }}
289-
body_path: release_notes.md
269+
body_path: release_body.md
290270
draft: false
291271
prerelease: ${{ needs.validate.outputs.is_prerelease == 'true' }}
292272
files: |

0 commit comments

Comments
 (0)