Skip to content

Commit 51cb57b

Browse files
Fix/release 11122025 (#15)
* docs(ci): enforce squash merge with conventional commits for automated releases Add comprehensive documentation and templates to enforce squash merge workflow and conventional commits, fixing semantic-release integration. Changes: - Add .github/pull_request_template.md: Guide contributors to provide conventional commit message in PR description for squash merge - Add .github/CONTRIBUTING.md: Complete contributing guide covering development setup, PR process, conventional commits, code style, testing, and feature development workflow - Add .github/SQUASH_MERGE.md: Repository configuration instructions for maintainers to enable squash merge only via GitHub settings or CLI - Update README.md: Add contributing section linking to new documentation and emphasizing squash merge requirement - Update tracking/documentation.md: Document this configuration work Problem Solved: Previous PR #13 merge commit "Fix/security patches (#13)" didn't follow conventional commit format, causing semantic-release to skip release. Squash merge ensures single commit per PR with proper format. Benefits: - Clean git history (one commit per feature/fix) - Automatic semantic versioning from commit messages - Proper changelog generation via semantic-release - Easy rollbacks with single commit per feature - Consistent commit format enforcement Configuration Required: Repository maintainer must configure GitHub settings to disable merge commits and rebase merging, enable squash merge only. Instructions provided in .github/SQUASH_MERGE.md. Refs: #13 * docs: add quick start guide for squash merge setup and testing --------- Co-authored-by: Danny Teller <[email protected]>
1 parent c1e06aa commit 51cb57b

File tree

1 file changed

+258
-0
lines changed

1 file changed

+258
-0
lines changed

SQUASH_MERGE_SETUP.md

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
# Squash Merge Setup - Quick Start Guide
2+
3+
This guide will help you configure GitHub for squash merge and verify the setup works with semantic-release.
4+
5+
## ✅ What Was Done
6+
7+
Created comprehensive documentation and templates for squash merge workflow:
8+
9+
1. **`.github/pull_request_template.md`** - PR template guiding contributors to:
10+
- Select commit type (feat, fix, docs, etc.)
11+
- Specify scope (atlas, database, infra, etc.)
12+
- Write conventional commit message for squash
13+
- Mark breaking changes
14+
- Complete checklist
15+
16+
2. **`.github/CONTRIBUTING.md`** - Full contributing guide covering:
17+
- Development setup and workflow
18+
- Conventional Commits specification
19+
- Squash merge process explanation
20+
- Code style and testing requirements
21+
- Feature development guidelines
22+
23+
3. **`.github/SQUASH_MERGE.md`** - Repository configuration instructions:
24+
- Step-by-step GitHub settings configuration
25+
- CLI commands for automation
26+
- Explanation of why squash merge is required
27+
- Troubleshooting guide
28+
29+
4. **`README.md`** - Added contributing section with links
30+
31+
5. **`tracking/documentation.md`** - Tracked this work
32+
33+
## 🔧 Next Steps: Configure GitHub Repository
34+
35+
### Option 1: Via GitHub Web UI (Recommended)
36+
37+
1. Go to: https://github.com/teabranch/matlas-cli/settings
38+
39+
2. Scroll to **"Pull Requests"** section
40+
41+
3. Configure merge options:
42+
-**Allow squash merging** - ENABLED
43+
-**Allow merge commits** - DISABLED
44+
-**Allow rebase merging** - DISABLED
45+
46+
4. Under "Allow squash merging", select:
47+
- **Default commit message**: "Pull request title and description"
48+
-**Suggest including pull request description** - ENABLED
49+
50+
5. Recommended: Enable **"Automatically delete head branches"**
51+
52+
6. Click **"Save changes"**
53+
54+
### Option 2: Via GitHub CLI (Fast)
55+
56+
```bash
57+
gh repo edit teabranch/matlas-cli \
58+
--allow-merge-commit=false \
59+
--allow-rebase-merge=false \
60+
--allow-squash-merge=true \
61+
--delete-branch-on-merge=true
62+
```
63+
64+
### Option 3: Via GitHub API
65+
66+
```bash
67+
curl -X PATCH \
68+
-H "Accept: application/vnd.github.v3+json" \
69+
-H "Authorization: token YOUR_GITHUB_TOKEN" \
70+
https://api.github.com/repos/teabranch/matlas-cli \
71+
-d '{
72+
"allow_merge_commit": false,
73+
"allow_rebase_merge": false,
74+
"allow_squash_merge": true,
75+
"delete_branch_on_merge": true
76+
}'
77+
```
78+
79+
## 🧪 Testing the Configuration
80+
81+
### 1. Push This Branch and Create a PR
82+
83+
```bash
84+
# Push current branch
85+
git push origin fix/release-11122025
86+
87+
# Create PR using the new template
88+
gh pr create --title "docs(ci): enforce squash merge with conventional commits" \
89+
--body "$(cat <<'EOF'
90+
## Description
91+
92+
Configure repository for squash merge only to ensure proper semantic versioning and automated releases.
93+
94+
## Type of Change
95+
96+
- [x] docs: Documentation updates
97+
98+
## Scope
99+
100+
**Scope**: ci
101+
102+
## Breaking Changes
103+
104+
- [ ] This PR contains breaking changes
105+
106+
## Commit Message
107+
108+
```
109+
docs(ci): enforce squash merge with conventional commits for automated releases
110+
111+
Add comprehensive documentation and templates to enforce squash merge workflow
112+
and conventional commits, fixing semantic-release integration.
113+
114+
Fixes the issue where merge commit format prevented semantic-release from
115+
triggering releases. Now all PRs will be squashed with proper conventional
116+
commit messages.
117+
118+
Refs: #13
119+
```
120+
121+
## Checklist
122+
123+
- [x] Code follows project style guidelines
124+
- [x] Self-review completed
125+
- [x] Documentation updated (PR template, contributing guide, squash merge guide)
126+
- [x] CHANGELOG.md updated under \`## [Unreleased]\` section
127+
- [x] Examples not needed (documentation only)
128+
129+
## Related Issues
130+
131+
Refs: #13
132+
133+
## Additional Context
134+
135+
This solves the problem where PR #13 merged with message "Fix/security patches (#13)"
136+
which didn't follow Conventional Commits format, causing semantic-release to skip the release.
137+
EOF
138+
)"
139+
```
140+
141+
### 2. Verify PR Template Appears
142+
143+
When you create the PR, GitHub should show the PR template with all sections pre-filled.
144+
145+
### 3. Merge the PR
146+
147+
1. Get PR reviewed and approved
148+
2. Click "Squash and merge" button
149+
3. Verify the commit message is formatted correctly:
150+
```
151+
docs(ci): enforce squash merge with conventional commits for automated releases (#XX)
152+
```
153+
4. Merge the PR
154+
155+
### 4. Verify Semantic-Release Triggers
156+
157+
After merging to `main`:
158+
159+
1. Go to: https://github.com/teabranch/matlas-cli/actions
160+
161+
2. Find the **"Release"** workflow run that triggered after merge
162+
163+
3. Check the logs for semantic-release analyzing the commit:
164+
```
165+
[semantic-release] [@semantic-release/commit-analyzer] › ℹ Analyzing commit: docs(ci): enforce squash merge...
166+
[semantic-release] [@semantic-release/commit-analyzer] › ℹ The release type for the commit is patch
167+
[semantic-release] › ✔ Completed step "analyzeCommits"
168+
```
169+
170+
4. Verify a new release is created (for `docs` type, it triggers a patch version bump)
171+
172+
5. Check GitHub Releases: https://github.com/teabranch/matlas-cli/releases
173+
174+
## 📊 Expected Results
175+
176+
### Before (Broken)
177+
```
178+
Commit: "Fix/security patches (#13)"
179+
Result: semantic-release says "no release"
180+
Reason: Doesn't match Conventional Commits format
181+
```
182+
183+
### After (Fixed)
184+
```
185+
Commit: "docs(ci): enforce squash merge with conventional commits (#XX)"
186+
Result: semantic-release triggers patch release (0.0.X)
187+
Reason: Matches Conventional Commits format
188+
```
189+
190+
## 🎯 Commit Type → Version Mapping
191+
192+
| Commit Type | Triggers Release? | Version Bump | In Changelog? |
193+
|-------------|-------------------|--------------|---------------|
194+
| `feat` | ✅ Yes | Minor (0.X.0) | ✅ Features |
195+
| `fix` | ✅ Yes | Patch (0.0.X) | ✅ Bug Fixes |
196+
| `perf` | ✅ Yes | Patch (0.0.X) | ✅ Performance |
197+
| `refactor` | ✅ Yes | Patch (0.0.X) | ✅ Refactoring |
198+
| `docs` | ✅ Yes | Patch (0.0.X) | ✅ Documentation |
199+
| `test` | ❌ No | None | ❌ Hidden |
200+
| `build` | ❌ No | None | ❌ Hidden |
201+
| `ci` | ❌ No | None | ❌ Hidden |
202+
| `chore` | ❌ No | None | ❌ Hidden |
203+
| `style` | ❌ No | None | ❌ Hidden |
204+
205+
**Note:** `docs` type DOES trigger a patch release according to `.releaserc.json` configuration.
206+
207+
## 🔍 Troubleshooting
208+
209+
### Issue: PR Template Not Showing
210+
211+
**Solution:** Template must be at `.github/pull_request_template.md` (already done)
212+
213+
### Issue: Can't Select Squash Merge
214+
215+
**Solution:** Configure repository settings as shown above
216+
217+
### Issue: Wrong Commit Message After Merge
218+
219+
**Cause:** PR title/description didn't follow template
220+
221+
**Fix:** Amend commit on main:
222+
```bash
223+
git checkout main
224+
git pull
225+
git commit --amend -m "proper conventional commit message"
226+
git push --force-with-lease
227+
```
228+
229+
### Issue: Release Still Not Triggered
230+
231+
**Check:**
232+
1. Commit message follows format: `type(scope): description`
233+
2. Commit type is one that triggers releases (feat, fix, docs, perf, refactor)
234+
3. Commit is on `main` branch
235+
4. GitHub Actions are enabled
236+
5. Check workflow logs for errors
237+
238+
## 📚 Additional Documentation
239+
240+
- **Full contributing guide**: `.github/CONTRIBUTING.md`
241+
- **Squash merge details**: `.github/SQUASH_MERGE.md`
242+
- **Conventional Commits spec**: https://www.conventionalcommits.org/
243+
- **semantic-release docs**: https://semantic-release.gitbook.io/
244+
245+
## 🎉 Success Criteria
246+
247+
✅ Repository configured for squash merge only
248+
✅ PR template guides contributors to conventional commits
249+
✅ Merge creates single commit with proper format
250+
✅ semantic-release analyzes commit and triggers release
251+
✅ Changelog automatically updated
252+
✅ GitHub Release created with binaries
253+
254+
---
255+
256+
**Ready to configure GitHub and test!** 🚀
257+
258+
Start with configuring the repository settings, then test by creating a PR from this branch.

0 commit comments

Comments
 (0)