Claude Code version watch #2
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
| name: Claude Code version watch | |
| on: | |
| schedule: | |
| - cron: '0 9 * * 1' | |
| workflow_dispatch: | |
| jobs: | |
| check-claude-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get latest Claude Code version from npm registry | |
| id: npm | |
| run: | | |
| LATEST=$(npm view @anthropic-ai/claude-code version 2>/dev/null || echo "") | |
| echo "latest=$LATEST" >> "$GITHUB_OUTPUT" | |
| - name: Get reviewed version from source | |
| id: reviewed | |
| run: | | |
| REVIEWED=$(grep 'BUILT_AGAINST_CLAUDE_VERSION' src/main.rs | sed -n 's/.*"\([^"]*\)".*/\1/p' | head -1) | |
| echo "reviewed=$REVIEWED" >> "$GITHUB_OUTPUT" | |
| - name: Compare and open issue if newer | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| LATEST: ${{ steps.npm.outputs.latest }} | |
| REVIEWED: ${{ steps.reviewed.outputs.reviewed }} | |
| run: | | |
| if [ -z "$LATEST" ]; then | |
| echo "Could not fetch npm version, skipping" | |
| exit 0 | |
| fi | |
| if [ -z "$REVIEWED" ]; then | |
| echo "BUILT_AGAINST_CLAUDE_VERSION not found in src/main.rs — skipping comparison" | |
| echo "(add 'const BUILT_AGAINST_CLAUDE_VERSION: &str = \"X.Y.Z\";' to enable upstream tracking)" | |
| exit 0 | |
| fi | |
| if [ "$LATEST" = "$REVIEWED" ]; then | |
| echo "Claude Code v$LATEST, no change (reviewed: v$REVIEWED)" | |
| exit 0 | |
| fi | |
| EXISTING=$(gh issue list --label "upstream-update" --state open --search "Claude Code v${LATEST} released" --json number --jq '.[0].number' 2>/dev/null || echo "") | |
| if [ -n "$EXISTING" ]; then | |
| echo "Issue already open (#$EXISTING), skipping" | |
| exit 0 | |
| fi | |
| echo "New Claude Code version detected: v$LATEST (reviewed: v$REVIEWED)" | |
| BODY=$(printf '## Claude Code upstream update\n\n| | Version |\n|---|---|\n| Latest npm release | `%s` |\n| Last reviewed in RustyClaw | `%s` |\n\n### What to do\n\n1. Check the [Claude Code changelog](https://github.com/anthropics/claude-code/releases)\n2. Review for anything that affects RustyClaw (new commands, API params, CLAUDE.md format, MCP changes)\n3. Implement relevant changes in RustyClaw\n4. Update BUILT_AGAINST_CLAUDE_VERSION in src/main.rs to `%s`\n5. Close this issue\n\n---\n*Opened automatically by the claude-version-watch workflow.*' "$LATEST" "$REVIEWED" "$LATEST") | |
| gh issue create \ | |
| --title "Claude Code v${LATEST} released -- review for RustyClaw" \ | |
| --label "upstream-update" \ | |
| --body "$BODY" |