Repository navigation
91 lines (81 loc) · 3.6 KB
/
Copy pathvalidate-plugins.yml
File metadata and controls
91 lines (81 loc) · 3.6 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
name: Validate Plugins
# Checks the plugin folders in this repository (.github/scripts/plugin-dirs.sh).
# A folder is checked whether or not marketplace.json lists it.
#
# `validate` is a required status check on main, so this has no path filter: a
# filtered-out run never reports, and the PR then waits for it forever.
on:
pull_request:
push:
branches: [main]
# Bump PRs are opened with GITHUB_TOKEN, which doesn't fire on:pull_request
# (recursion guard), so the bump workflow dispatches this against each bump
# branch instead.
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 (sha-pinned)
- name: Install Claude Code
run: |
# The native binary is an optional dependency whose download sometimes
# stalls, so check that it runs and retry from a clean state.
for attempt in 1 2 3; do
timeout -k 10 300 npm install -g --include=optional @anthropic-ai/claude-code@latest || true
if claude --version; then exit 0; fi
timeout -k 10 300 node "$(npm root -g)/@anthropic-ai/claude-code/install.cjs" || true
if claude --version; then exit 0; fi
npm uninstall -g @anthropic-ai/claude-code || true
npm cache clean --force || true
sleep $((attempt * 10))
done
echo "::error::Claude Code did not install after 3 attempts."
exit 1
- name: Validate plugin folders
run: bun .github/scripts/validate-plugin-folders.ts
- name: Validate frontmatter of agents, skills and commands
run: |
set -euo pipefail
(cd .github/scripts && bun install --no-save yaml@2)
dirs="$(bash .github/scripts/plugin-dirs.sh)"
failed=0
while IFS= read -r dir; do
bun .github/scripts/validate-frontmatter.ts "$dir" || failed=1
done <<< "$dirs"
exit "$failed"
# TODO: remove this step and the next once marketplace.json lists only
# first-party plugins. Until then it still serves third-party entries, so a
# change to the file must keep it loadable and every source SHA-pinned (I5).
- name: Check whether marketplace.json changed
id: marketplace
env:
EVENT: ${{ github.event_name }}
BASE: ${{ github.event.pull_request.base.sha || github.event.before || 'origin/main' }}
run: |
if [[ "$EVENT" != "workflow_dispatch" ]] &&
git diff --quiet "$BASE"...HEAD -- .claude-plugin/ .github/workflows/validate-plugins.yml; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
# On a dispatch (bump branches), and when the diff itself fails:
# check rather than skip.
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Validate marketplace.json
if: steps.marketplace.outputs.changed == 'true'
uses: anthropics/claude-plugins-community/.github/actions/validate-plugins@163301d1904c0a994539f5226ce0fcd65b8652bf
with:
marketplace-path: .claude-plugin/marketplace.json
skip-local-folders: "true"
warn-invariants: "I1 I3 I8 I11"
# Plugins resolved by a local command instead of a git repo (no sha to
# pin). Each name here is a listing decision: add one only with
# marketplace-ops sign-off.
command-exempt: "xcode"
claude-cli-version: latest