Files
claude-code/.github/workflows/update-devcontainer-version.yml
Claude 441064b1bf feat: auto-update Dockerfile with current claude-code npm version
- Add GitHub workflow to automatically check for new claude-code versions daily
- Pin CLAUDE_CODE_VERSION to 2.0.55 (instead of 'latest') in Dockerfile and devcontainer.json
- Workflow creates PRs when new versions are available, ensuring Docker cache invalidation

Fixes #582
2025-11-30 04:13:14 +00:00

63 lines
2.4 KiB
YAML

name: Update DevContainer Claude Code Version
on:
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch: # Allow manual trigger
jobs:
update-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get latest npm version
id: npm-version
run: |
LATEST_VERSION=$(npm view @anthropic-ai/claude-code version)
echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
echo "Latest npm version: $LATEST_VERSION"
- name: Get current version from Dockerfile
id: current-version
run: |
CURRENT_VERSION=$(grep -oP 'ARG CLAUDE_CODE_VERSION=\K[^\s]+' .devcontainer/Dockerfile)
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Current version: $CURRENT_VERSION"
- name: Update version if changed
if: steps.npm-version.outputs.version != steps.current-version.outputs.version
run: |
NEW_VERSION="${{ steps.npm-version.outputs.version }}"
# Update Dockerfile
sed -i "s/ARG CLAUDE_CODE_VERSION=.*/ARG CLAUDE_CODE_VERSION=$NEW_VERSION/" .devcontainer/Dockerfile
# Update devcontainer.json
sed -i "s/\"CLAUDE_CODE_VERSION\": \".*\"/\"CLAUDE_CODE_VERSION\": \"$NEW_VERSION\"/" .devcontainer/devcontainer.json
echo "Updated version to $NEW_VERSION"
- name: Create Pull Request
if: steps.npm-version.outputs.version != steps.current-version.outputs.version
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}"
title: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}"
body: |
This PR automatically updates the claude-code version in the devcontainer configuration.
**Changes:**
- Updated `CLAUDE_CODE_VERSION` from `${{ steps.current-version.outputs.version }}` to `${{ steps.npm-version.outputs.version }}`
This ensures Docker cache is invalidated when rebuilding images, allowing users to get the latest claude-code version.
Related: #582
branch: chore/update-claude-code-version
delete-branch: true