You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve update-changelog command with better git workflow (#1961)
## Summary
Ports enhancements from Shakapacker PR #824 to improve the
`/update-changelog` slash command:
- **Explicit git fetch step**: Always fetch `origin/master` first to
ensure latest commits are available
- **Consistent origin/master usage**: Use `origin/master` instead of
local `master` throughout to avoid missing recently merged PRs
- **Automatic PR extraction**: Use grep to extract ALL PR numbers from
commit history automatically
- **PR existence checking**: Check if PRs are already documented before
adding duplicates
- **Version links documentation**: Add detailed instructions for
managing version comparison links
- **Simplified linting**: Use just `yarn lint` instead of multiple
commands
- **Better change identification**: Provide keyword hints for
identifying user-visible changes
## Test plan
- [x] Review the updated command documentation
- [x] Verify formatting with Prettier
- [x] Confirm pre-commit hooks pass
- [ ] Test the command with actual changelog updates
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1961)
<!-- Reviewable:end -->
Co-authored-by: Claude <[email protected]>
3. Update the `[Unreleased]` link to compare from the new version
114
+
4. Add a new version link for the released version
115
+
98
116
## Process
99
117
100
118
### For Regular Changelog Updates
101
119
102
-
1.**Determine the correct version tag to compare against**:
120
+
1.**ALWAYS fetch latest changes first**:
121
+
122
+
-**CRITICAL**: Run `git fetch origin master` to ensure you have the latest commits
123
+
- The workspace may be behind origin/master, causing you to miss recently merged PRs
124
+
- After fetching, use `origin/master` for all comparisons, NOT local `master` branch
125
+
126
+
2.**Determine the correct version tag to compare against**:
103
127
104
128
- First, check the tag dates: `git log --tags --simplify-by-decoration --pretty="format:%ai %d" | head -10`
105
129
- Find the latest version tag and its date
106
-
- Compare main branch date to the tag date
107
-
- If the tag is NEWER than main, it means main needs to be updated to include the tag's commits
130
+
- Compare origin/master branch date to the tag date
131
+
- If the tag is NEWER than origin/master, it means the branch needs to be updated to include the tag's commits
108
132
-**CRITICAL**: Always use `git log TAG..BRANCH` to find commits that are in the tag but not in the branch, as the tag may be ahead
109
133
110
-
2.**Check commits and version boundaries**:
134
+
3.**Check commits and version boundaries**:
111
135
112
-
- Run `git log --oneline LAST_TAG..master` to see commits since the last release
113
-
- Also check `git log --oneline master..LAST_TAG` to see if the tag is ahead of master
136
+
-**IMPORTANT**: Use `origin/master` in all commands below, not local `master`
137
+
- Run `git log --oneline LAST_TAG..origin/master` to see commits since the last release
138
+
- Also check `git log --oneline origin/master..LAST_TAG` to see if the tag is ahead of origin/master
114
139
- If the tag is ahead, entries in "Unreleased" section may actually belong to that tagged version
115
-
- Identify which commits contain user-visible changes
116
-
- Extract PR numbers and author information from commit messages
117
-
-**Never ask the user for PR details** - get them from the git history
140
+
-**Extract ALL PR numbers** from commit messages using grep: `git log --oneline LAST_TAG..origin/master | grep -oE "#[0-9]+" | sort -u`
141
+
- For each PR number found, check if it's already in CHANGELOG.md using: `grep "PR XXX" CHANGELOG.md` (note: no hash in search since React on Rails uses no hash)
142
+
- Identify which commits contain user-visible changes (look for keywords like "Fix", "Add", "Feature", "Bug", etc.)
143
+
- Extract author information from commit messages
144
+
-**Never ask the user for PR details** - get them from the git history or use WebFetch on the PR URL
118
145
119
-
3.**Validate** that changes are user-visible (per the criteria above). If not user-visible, skip those commits.
146
+
4.**Validate** that changes are user-visible (per the criteria above). If not user-visible, skip those commits.
120
147
121
-
4.**Read the current CHANGELOG.md** to understand the existing structure and formatting.
148
+
5.**Read the current CHANGELOG.md** to understand the existing structure and formatting.
122
149
123
-
5.**Determine where entries should go**:
150
+
6.**Determine where entries should go**:
124
151
125
-
- If the latest version tag is NEWER than master branch, move entries from "Unreleased" to that version section
126
-
- If master is ahead of the latest tag, add new entries to "Unreleased"
152
+
- If the latest version tag is NEWER than origin/master branch, move entries from "Unreleased" to that version section
153
+
- If origin/master is ahead of the latest tag, add new entries to "Unreleased"
127
154
- Always verify the version date in CHANGELOG.md matches the actual tag date
128
155
129
-
6.**Add or move entries** to the appropriate section under appropriate category headings.
156
+
7.**Add or move entries** to the appropriate section under appropriate category headings.
130
157
131
158
-**CRITICAL**: When moving entries from "Unreleased" to a version section, merge them with existing entries under the same category heading
0 commit comments