Skip to content

Commit f04ee90

Browse files
committed
[skill] Fix release skill to gather changes from origin/main, not current branch
1 parent 01a8495 commit f04ee90

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

.claude/skills/release/SKILL.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,33 @@ Confirm the new version with the user before proceeding.
3434

3535
### 2. Gather changes since last release
3636

37-
Run:
37+
**Always gather from `origin/main`** — that's where PRs are merged. The current working branch is irrelevant here.
38+
39+
Step 1 — find the last release commit on main and list everything since it:
40+
```bash
41+
git fetch origin main --quiet
42+
git log --oneline $(git log --oneline origin/main | grep "\[release\]" | head -1 | awk '{print $1}')..origin/main
43+
```
44+
45+
Step 2 — extract PR numbers from merge commits and fetch details for each:
3846
```bash
39-
git log --oneline $(git log --oneline | grep "\[release\]" | head -1 | awk '{print $1}')..HEAD
47+
git log --oneline $(git log --oneline origin/main | grep "\[release\]" | head -1 | awk '{print $1}')..origin/main | grep "Merge pull request" | grep -oE '#[0-9]+' | tr -d '#'
4048
```
4149

42-
This finds commits since the last `[release]` commit. If none exist, use all commits on the current branch.
50+
Then for each PR number, run:
51+
```bash
52+
gh pr view <number> --json title,labels,body,mergedAt
53+
```
4354

44-
Also check merged PRs for additional context:
55+
If `gh` is not authenticated, fall back to the commit subjects alone — do NOT skip this step or silently use an empty list. Note any PRs you couldn't fetch so the user knows the notes may be incomplete.
56+
57+
Step 3 — also run this to catch non-merge commits (direct pushes, fixups, etc.):
4558
```bash
46-
gh pr list --state merged --base main --limit 30 --json title,labels,number,mergedAt
59+
git log --oneline --no-merges $(git log --oneline origin/main | grep "\[release\]" | head -1 | awk '{print $1}')..origin/main
4760
```
4861

62+
Use all of this — PR titles, PR bodies, labels, and direct commit messages — to write the release notes.
63+
4964
---
5065

5166
### 3. Draft release notes

0 commit comments

Comments
 (0)