-
Notifications
You must be signed in to change notification settings - Fork 24
chore: add claude skill for changelog analysis #490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
.claude/skills/version-bump-analysis/extract-changelog-version.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Extract a specific version section from an OpenTelemetry changelog | ||
| # Usage: extract-changelog-version.sh <url> <version> | ||
| # Example: extract-changelog-version.sh "https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/main/CHANGELOG.md" "v0.144.0" | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| if [ "$#" -ne 2 ]; then | ||
| echo "Usage: $0 <changelog_url> <version>" >&2 | ||
| echo "Example: $0 'https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/main/CHANGELOG.md' 'v0.144.0'" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| CHANGELOG_URL="$1" | ||
| VERSION="$2" | ||
|
|
||
| # Fetch changelog and extract the specific version section | ||
| # The version appears in headers like "## v1.50.0/v0.144.0" | ||
| # We extract from that header until the next "## " header or "<!-- previous-version -->" | ||
| curl -s "$CHANGELOG_URL" | awk -v version="$VERSION" \ | ||
| 'BEGIN { found=0; printing=0 } \ | ||
| /^## / { if (found) { exit } if ($0 ~ version) { found=1; printing=1; print $0; next } } \ | ||
| /^<!-- previous-version -->/ { if (printing) { exit } } \ | ||
| printing { print $0 }' | ||
|
|
||
| exit 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| --- | ||
| name: version-bump-analysis | ||
| description: | | ||
| Analyzes OpenTelemetry Collector component version bumps and compiles a markdown | ||
| summary of relevant changes (breaking changes, deprecations, bug fixes) from the | ||
| upstream CHANGELOG files. Only includes changes for components used in the nrdot | ||
| releases repo. Outputs a formatted comment ready to paste into a GitHub PR. | ||
| trigger: /version-bump-analysis | ||
| type: agent | ||
| parameters: | ||
| - name: pr_url | ||
| description: "GitHub PR URL containing the version bump (e.g., https://github.com/newrelic/nrdot-collector-releases/pull/488)" | ||
| required: true | ||
| permissions: | ||
| - Read | ||
| - Glob | ||
| - Bash | ||
| - mcp__plugin_nr_google-search__web_fetch | ||
kb-newrelic marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| # Version Bump Analysis Skill | ||
|
|
||
| Analyzes OpenTelemetry Collector component version bumps and compiles a markdown summary of relevant changes for PR comments. | ||
|
|
||
| ## Input | ||
|
|
||
| - A GitHub PR URL from the `newrelic/nrdot-collector-releases` repository | ||
| - The PR will contain version bumps with a title like "feat: Bump OTEL beta core to v0.144.0" | ||
| - The PR description will include version ranges like "v0.142.0...v0.144.0" | ||
|
|
||
| ## Output Format | ||
|
|
||
| Generate a markdown comment that can be pasted directly into the PR, following this structure: | ||
|
|
||
| ```markdown | ||
| ### Potentially Relevant changes | ||
|
|
||
| #### Contrib v[VERSION] | ||
|
|
||
| ##### 🛑 Breaking changes 🛑 | ||
|
|
||
| - [List breaking changes with full descriptions from CHANGELOG] | ||
|
|
||
| ##### 🚩 Deprecations 🚩 | ||
|
|
||
| - [List deprecations with full descriptions from CHANGELOG] | ||
|
|
||
| ##### 🧰 Bug fixes 🧰 | ||
|
|
||
| - [List bug fixes that may be relevant] | ||
|
|
||
| #### Core v[VERSION] | ||
|
|
||
| [Same structure as Contrib if there are relevant changes] | ||
| ``` | ||
|
|
||
| ## ⚠️ IMPORTANT: Do NOT Use google-search Plugin for CHANGELOG Files | ||
|
|
||
| **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: | ||
|
|
||
| ```bash | ||
| .claude/skills/version-bump-analysis/extract-changelog-version.sh <changelog_url> <version> | ||
| ``` | ||
|
|
||
| This script efficiently fetches and extracts only the relevant version section using curl and awk. | ||
|
|
||
| ### Example Usage | ||
|
|
||
| ```bash | ||
| # Extract v0.144.0 from OTel Core CHANGELOG | ||
| .claude/skills/version-bump-analysis/extract-changelog-version.sh \ | ||
| "https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/main/CHANGELOG.md" \ | ||
| "v0.144.0" | ||
|
|
||
| # Extract v0.144.0 from OTel Contrib CHANGELOG | ||
| .claude/skills/version-bump-analysis/extract-changelog-version.sh \ | ||
| "https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/CHANGELOG.md" \ | ||
| "v0.144.0" | ||
| ``` | ||
|
|
||
| ## Implementation Steps | ||
|
|
||
| 1. **Extract list of used components from manifest files**: | ||
| - Use Glob to find all `distributions/*/manifest.yaml` files | ||
| - Use Read to load each manifest file | ||
| - Parse the YAML to extract component names from: | ||
| - `receivers:` section | ||
| - `processors:` section | ||
| - `exporters:` section | ||
| - `connectors:` section | ||
| - `extensions:` section | ||
| - `providers:` section | ||
| - Extract component names from gomod paths (e.g., `receiver/filelogreceiver` → `receiver/filelog`) | ||
| - Build a set of all unique component names used across all distributions | ||
| - Component names in CHANGELOG use format: `receiver/filelog`, `processor/cumulativetodelta`, etc. | ||
|
|
||
| 2. **Extract version information from the PR**: | ||
| - Fetch the PR page using web_fetch | ||
| - Extract the "from" and "to" versions from the PR description | ||
| - The description includes links like: `Beta Core: [v0.142.0...v0.144.0]` and `Beta Contrib: [v0.142.0...v0.144.0]` | ||
|
|
||
| 3. **Fetch CHANGELOG sections for each version**: | ||
| - Contrib CHANGELOG: `https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector-contrib/main/CHANGELOG.md` | ||
| - Core CHANGELOG: `https://raw.githubusercontent.com/open-telemetry/opentelemetry-collector/main/CHANGELOG.md` | ||
| - **Use the extract-changelog-version.sh script** (NOT web_fetch or raw_http_fetch) | ||
| - For each version in the range, call: `.claude/skills/version-bump-analysis/extract-changelog-version.sh <url> <version>` | ||
| - This returns only the relevant section for that version (typically <1000 lines vs 66k+ for full file) | ||
|
|
||
| 4. **Parse version sections**: | ||
| - For each version between "from" and "to" (inclusive of "to", exclusive of "from") | ||
| - Extract sections marked as: | ||
| - `### 🛑 Breaking changes 🛑` or `## 🛑 Breaking changes 🛑` | ||
| - `### 🚩 Deprecations 🚩` or `## 🚩 Deprecations 🚩` | ||
| - `### 🧰 Bug fixes 🧰` or `## 🧰 Bug fixes 🧰` | ||
| - Preserve the full descriptions and component names from the CHANGELOG | ||
|
|
||
| 5. **Filter for component relevance**: | ||
| - Only include CHANGELOG entries that mention components from the manifest files | ||
| - Match component names like `receiver/filelog`, `processor/batch`, `exporter/otlp`, etc. | ||
| - Include entries where the component name appears at the start of the bullet point | ||
| - Format: `` `component/name`: description `` | ||
| - Also include changes to core collector functionality that affect all components (if any) | ||
|
|
||
| 6. **Format the output**: | ||
| - Use the exact emoji and header format from the example | ||
| - Preserve markdown formatting from the CHANGELOG | ||
| - Include component names in the format `` `component/name`: description `` | ||
| - Add clear section headers for Contrib and Core | ||
| - Only include sections that have content (omit empty sections) | ||
| - If no relevant changes found, output: "No breaking changes, deprecations, or relevant bug fixes found for components used in this repo." | ||
|
|
||
| 7. **Save the output to a file**: | ||
| - Create the `.tmp` directory if it doesn't exist using: `mkdir -p .tmp` | ||
| - Write the markdown output to a file in `.tmp` directory with naming pattern: `version-bump-analysis-pr{PR_NUMBER}.md` | ||
| - Example: For PR #488, write to `.tmp/version-bump-analysis-pr488.md` | ||
| - Use the Write tool to save the formatted markdown content to this file | ||
|
|
||
| ## Important Notes | ||
|
|
||
| - The skill should handle multiple version bumps (e.g., v0.142.0 to v0.144.0 means analyzing both v0.143.0 and v0.144.0) | ||
| - Preserve the exact wording from the CHANGELOG - don't summarize or paraphrase | ||
| - If there are no breaking changes or deprecations for a section, omit that section entirely | ||
| - The output should be ready to copy-paste directly into a GitHub PR comment | ||
| - Always include the version number in section headers (e.g., "Contrib v0.144.0") | ||
| - If bumping multiple versions, combine changes from all versions into a single output | ||
| - **CRITICAL**: Only include changes for components that are listed in the manifest.yaml files | ||
|
|
||
| ## Component Name Mapping | ||
|
|
||
| When matching CHANGELOG entries to manifest components: | ||
| - Manifest: `receiver/filelogreceiver` → CHANGELOG: `receiver/filelog` | ||
| - Manifest: `processor/batchprocessor` → CHANGELOG: `processor/batch` | ||
| - Manifest: `exporter/otlpexporter` → CHANGELOG: `exporter/otlp` | ||
| - Pattern: Remove the trailing "receiver", "processor", "exporter", etc. suffix to get the CHANGELOG name | ||
|
|
||
| ## Example Reference | ||
|
|
||
| See https://github.com/newrelic/nrdot-collector-releases/pull/464#issuecomment-3671968859 for the expected output format. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.