forked from moazbuilds/claudeclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (49 loc) · 2.23 KB
/
Copy pathplugin-version-guard.yml
File metadata and controls
62 lines (49 loc) · 2.23 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
name: Plugin Version Guard
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
plugin-version-guard:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Require plugin version bump for shipped plugin changes
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
changed_files="$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")"
echo "Changed files:"
printf '%s\n' "$changed_files"
if [ -z "$changed_files" ]; then
echo "No changed files detected."
exit 0
fi
shipped_pattern='^(src/|commands/|prompts/|\.claude-plugin/)'
if ! printf '%s\n' "$changed_files" | grep -Eq "$shipped_pattern"; then
echo "Docs-only or non-shipped changes detected; plugin version bump not required."
exit 0
fi
if ! printf '%s\n' "$changed_files" | grep -Fxq ".claude-plugin/plugin.json"; then
echo "Shipped plugin files changed but .claude-plugin/plugin.json was not updated."
echo "Run: bun run bump:plugin-version"
echo "If your PR also touches marketplace metadata expectations, you may also need:"
echo " bun run bump:marketplace-version"
exit 1
fi
base_version="$(git show "$BASE_SHA:.claude-plugin/plugin.json" | python3 -c 'import json,sys; print(json.load(sys.stdin)["version"])')"
head_version="$(python3 -c 'import json; print(json.load(open(".claude-plugin/plugin.json"))["version"])')"
if [ "$base_version" = "$head_version" ]; then
echo "Shipped plugin files changed but plugin version did not change ($head_version)."
echo "Run: bun run bump:plugin-version"
echo "If your PR also touches marketplace metadata expectations, you may also need:"
echo " bun run bump:marketplace-version"
exit 1
fi
echo "Plugin version changed: $base_version -> $head_version"