Skip to content

Commit 71be688

Browse files
committed
chore: improve version-bump-analysis skill based on PR feedback
1 parent de15fcc commit 71be688

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.claude/skills/version-bump-analysis/extract-changelog-version.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ VERSION="$2"
1818
# Fetch changelog and extract the specific version section
1919
# The version appears in headers like "## v1.50.0/v0.144.0"
2020
# We extract from that header until the next "## " header or "<!-- previous-version -->"
21-
curl -s "$CHANGELOG_URL" | awk -v version="$VERSION" \
21+
OUTPUT=$(curl -s "$CHANGELOG_URL" | awk -v version="$VERSION" \
2222
'BEGIN { found=0; printing=0 } \
2323
/^## / { if (found) { exit } if ($0 ~ version) { found=1; printing=1; print $0; next } } \
2424
/^<!-- previous-version -->/ { if (printing) { exit } } \
25-
printing { print $0 }'
25+
printing { print $0 }')
2626

27+
# Check if version was found
28+
if [ -z "$OUTPUT" ]; then
29+
echo "Error: Version $VERSION not found in changelog at $CHANGELOG_URL" >&2
30+
exit 1
31+
fi
32+
33+
echo "$OUTPUT"
2734
exit 0

.claude/skills/version-bump-analysis/skill.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ permissions:
1515
- Read
1616
- Glob
1717
- Bash
18-
- mcp__plugin_nr_google-search__web_fetch
1918
---
2019

2120
# Version Bump Analysis Skill
@@ -54,9 +53,9 @@ Generate a markdown comment that can be pasted directly into the PR, following t
5453
[Same structure as Contrib if there are relevant changes]
5554
```
5655

57-
## ⚠️ IMPORTANT: Do NOT Use google-search Plugin for CHANGELOG Files
56+
## ⚠️ IMPORTANT: Use Bash Script for CHANGELOG Files
5857

59-
**The google-search plugin (web_fetch/raw_http_fetch) fails with large CHANGELOG files** (~66k tokens) causing API errors. Instead, use the provided bash script:
58+
**Do NOT fetch full CHANGELOG files directly** - they are very large (~66k tokens) and inefficient. Instead, use the provided bash script to extract only the relevant version section:
6059

6160
```bash
6261
.claude/skills/version-bump-analysis/extract-changelog-version.sh <changelog_url> <version>
@@ -95,16 +94,17 @@ This script efficiently fetches and extracts only the relevant version section u
9594
- Component names in CHANGELOG use format: `receiver/filelog`, `processor/cumulativetodelta`, etc.
9695

9796
2. **Extract version information from the PR**:
98-
- Fetch the PR page using web_fetch
97+
- Use `gh pr view <pr_number> --json body --jq .body` to fetch the PR description
9998
- Extract the "from" and "to" versions from the PR description
10099
- The description includes links like: `Beta Core: [v0.142.0...v0.144.0]` and `Beta Contrib: [v0.142.0...v0.144.0]`
101100

102101
3. **Fetch CHANGELOG sections for each version**:
103102
- Contrib CHANGELOG: `https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/CHANGELOG.md`
104103
- Core CHANGELOG: `https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/main/CHANGELOG.md`
105-
- **Use the extract-changelog-version.sh script** (NOT web_fetch or raw_http_fetch)
104+
- **Use the extract-changelog-version.sh script** to efficiently extract only the relevant version sections
106105
- For each version in the range, call: `.claude/skills/version-bump-analysis/extract-changelog-version.sh <url> <version>`
107106
- This returns only the relevant section for that version (typically <1000 lines vs 66k+ for full file)
107+
- The script will exit with status 1 if the version is not found, allowing error detection
108108

109109
4. **Parse version sections**:
110110
- For each version between "from" and "to" (inclusive of "to", exclusive of "from")

0 commit comments

Comments
 (0)