-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (108 loc) · 4.52 KB
/
claude-cli-version-check.yml
File metadata and controls
120 lines (108 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Claude CLI Version Check
on:
schedule:
# Run daily at 09:00 UTC
- cron: "0 9 * * *"
workflow_dispatch: {}
permissions:
contents: read
issues: write
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Get pinned version from Dockerfile
id: pinned
run: |
VERSION=$(grep 'ARG CLAUDE_CLI_VERSION=' providers/workspaces/claude-cli/Dockerfile | cut -d= -f2)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Pinned version: $VERSION"
- name: Get latest npm version and changelog
id: latest
run: |
VERSION=$(npm view @anthropic-ai/claude-code version)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Latest version: $VERSION"
# Fetch changelog from npm package metadata (repository URL)
REPO_URL=$(npm view @anthropic-ai/claude-code repository.url 2>/dev/null | sed 's|git+||;s|\.git$||;s|ssh://git@|https://|')
if [ -n "$REPO_URL" ]; then
CHANGELOG_URL="${REPO_URL}/releases"
echo "changelog_url=$CHANGELOG_URL" >> "$GITHUB_OUTPUT"
else
echo "changelog_url=https://www.npmjs.com/package/@anthropic-ai/claude-code?activeTab=versions" >> "$GITHUB_OUTPUT"
fi
- name: Compare versions
if: steps.pinned.outputs.version != steps.latest.outputs.version
run: |
echo "::warning::Claude CLI updated: ${{ steps.pinned.outputs.version }} -> ${{ steps.latest.outputs.version }}"
echo "Review changelog and test JSONL contract before bumping."
echo "Key areas: tool names (ClaudeToolName), stream-json schema, hook event names."
- name: Open issue if version changed
if: steps.pinned.outputs.version != steps.latest.outputs.version
uses: actions/github-script@v8
with:
script: |
const pinned = '${{ steps.pinned.outputs.version }}';
const latest = '${{ steps.latest.outputs.version }}';
const changelogUrl = '${{ steps.latest.outputs.changelog_url }}';
const title = `Claude CLI update available: ${pinned} -> ${latest}`;
// Ensure label exists (avoid 422 if missing)
try {
await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'claude-cli-update',
});
} catch {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'claude-cli-update',
color: '1d76db',
description: 'Claude CLI version update available',
});
}
// Check if issue already exists
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'claude-cli-update',
});
if (issues.data.some(i => i.title === title)) {
console.log('Issue already exists, skipping.');
return;
}
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
labels: ['claude-cli-update'],
body: [
`## Claude CLI Version Update`,
``,
`| | Version |`,
`|---|---|`,
`| **Pinned** | \`${pinned}\` |`,
`| **Latest** | \`${latest}\` |`,
``,
`### Changelog`,
``,
`${changelogUrl}`,
``,
`### Before bumping, verify:`,
`- [ ] Tool names haven't changed (check \`ClaudeToolName\` in \`agentic_events/types.py\`)`,
`- [ ] \`stream-json\` output schema is compatible`,
`- [ ] Hook event names (\`SessionStart\`, \`PreToolUse\`, etc.) are unchanged`,
`- [ ] Run subagent-demo workflow and confirm \`subagent_started\`/\`subagent_stopped\` events appear`,
``,
`### To bump:`,
`\`\`\`dockerfile`,
`# providers/workspaces/claude-cli/Dockerfile`,
`ARG CLAUDE_CLI_VERSION=${latest}`,
`\`\`\``,
``,
`Then rebuild: \`just workspace-build\``,
].join('\n'),
});