diff options
| author | Claude <noreply@anthropic.com> | 2026-11-12 04:09:25 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-11-12 05:53:40 +0000 |
| commit | 1b650f9f1f3c333c2322ba0d0bd10a0df39c94b0 (patch) | |
| tree | 1f0909c32e70530906ad7f4b4de685c3a5d5c8d3 /.github | |
| parent | e37d307bd9f85dab6fea5dfb5e3dc146753b2d2d (diff) | |
CI: validate in-repo plugin folders; point submissions to claude.ai/directory/manageclaude/project-thread-eh90kw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6KzrBh3DugYtWavUz8Hv4
Diffstat (limited to '.github')
| -rw-r--r-- | .github/scripts/external-pr-scope.js | 9 | ||||
| -rw-r--r-- | .github/scripts/plugin-dirs.sh | 10 | ||||
| -rw-r--r-- | .github/scripts/validate-frontmatter.ts | 6 | ||||
| -rw-r--r-- | .github/scripts/validate-plugin-folders.ts | 207 | ||||
| -rw-r--r-- | .github/workflows/check-mcp-urls.yml | 34 | ||||
| -rw-r--r-- | .github/workflows/close-external-prs.yml | 18 | ||||
| -rw-r--r-- | .github/workflows/external-pr-scope-guard.yml | 3 | ||||
| -rw-r--r-- | .github/workflows/validate-frontmatter.yml | 42 | ||||
| -rw-r--r-- | .github/workflows/validate-plugins.yml | 131 |
9 files changed, 321 insertions, 139 deletions
diff --git a/.github/scripts/external-pr-scope.js b/.github/scripts/external-pr-scope.js index cf31e441..95c7aa68 100644 --- a/.github/scripts/external-pr-scope.js +++ b/.github/scripts/external-pr-scope.js @@ -18,6 +18,13 @@ const MARKETPLACE = '.claude-plugin/marketplace.json'; +// Posted on every pull request from outside Anthropic. +const SUBMISSION_NOTICE = [ + 'Thanks for your interest! Plugins are now submitted at **https://claude.ai/directory/manage**. Plugins accepted there are served across Claude products.', + 'The `marketplace.json` in this repository is being phased out: it will be reduced over time to Anthropic\'s own plugins.', + 'Pull requests here are not monitored, so please use the link above to submit or update a plugin.', +].join('\n\n'); + function normalizeRepo(u) { return String(u || '').trim().toLowerCase() .replace(/^git\+/, '') @@ -153,4 +160,4 @@ async function isExemptAuthor({ github, context }) { return { exempt: false }; } -module.exports = { normalizeRepo, liveReposOf, analyze, readPlugins, evaluate, isExemptAuthor, MARKETPLACE }; +module.exports = { normalizeRepo, liveReposOf, analyze, readPlugins, evaluate, isExemptAuthor, MARKETPLACE, SUBMISSION_NOTICE }; diff --git a/.github/scripts/plugin-dirs.sh b/.github/scripts/plugin-dirs.sh new file mode 100644 index 00000000..7bfa0f4b --- /dev/null +++ b/.github/scripts/plugin-dirs.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# Print the folders of the plugins that live in this repository, one per line, +# relative to the repo root. +set -euo pipefail +shopt -s nullglob +cd "$(dirname "${BASH_SOURCE[0]}")/../.." + +for dir in plugins/*/ external_plugins/*/; do + printf '%s\n' "${dir%/}" +done diff --git a/.github/scripts/validate-frontmatter.ts b/.github/scripts/validate-frontmatter.ts index 2aafe8f1..15255054 100644 --- a/.github/scripts/validate-frontmatter.ts +++ b/.github/scripts/validate-frontmatter.ts @@ -34,6 +34,12 @@ function quoteSpecialValues(text: string): string { result.push(line); continue; } + // Skip block scalar headers ("description: |"): the value is on the + // lines below + if (/^[|>][-+0-9]*\s*(#.*)?$/.test(value)) { + result.push(line); + continue; + } // Skip already-quoted values if ( (value.startsWith('"') && value.endsWith('"')) || diff --git a/.github/scripts/validate-plugin-folders.ts b/.github/scripts/validate-plugin-folders.ts new file mode 100644 index 00000000..0b2b8a06 --- /dev/null +++ b/.github/scripts/validate-plugin-folders.ts @@ -0,0 +1,207 @@ +#!/usr/bin/env bun +/** + * Validates the plugin folders in this repository (plugin-dirs.sh) with + * `claude plugin validate`. Needs `claude` on PATH; run from the repo root. + * + * Each folder is checked twice, because neither check is enough alone: + * + * 1. On its own, which covers the manifest and the plugin's files. This + * rejects names such as "claude-security" as reserved for Anthropic: the + * CLI can't tell from a bare folder that the plugin is ours. So a problem + * with `name` is ignored here and left to check 2. + * 2. All together, listed in a throwaway marketplace with this marketplace's + * name. Reserved names are allowed there and other bad names are not, and + * a plugin need not be listed in the real marketplace.json to be checked. + */ + +import { spawnSync } from "child_process"; +import { + cpSync, + existsSync, + mkdirSync, + mkdtempSync, + readFileSync, + rmSync, + writeFileSync, +} from "fs"; +import { tmpdir } from "os"; +import { basename, dirname, join } from "path"; + +const MARKETPLACE_NAME = "claude-plugins-official"; +const CLI_TIMEOUT_MS = 120_000; +// Files the plugin loader reads. The CLI doesn't report every one of these +// when it isn't valid JSON. +const JSON_FILES = [".mcp.json", ".lsp.json", "hooks/hooks.json"]; + +interface Issue { + path: string; + message: string; +} +interface FileReport { + file: string; + errors: Issue[]; + warnings: Issue[]; +} +interface Report { + success: boolean; + manifest: FileReport | null; + contents: FileReport[]; +} + +function run(cmd: string, args: string[]) { + const r = spawnSync(cmd, args, { + encoding: "utf8", + maxBuffer: 64 * 1024 * 1024, + timeout: CLI_TIMEOUT_MS, + }); + if (r.error) throw r.error; + return r; +} + +function cliValidate(path: string): Report { + // Exits 1 with a report on stdout when the plugin is not valid. + const r = run("claude", ["plugin", "validate", "--json", path]); + try { + const report = JSON.parse(r.stdout) as Report; + if (typeof report.success !== "boolean" || !Array.isArray(report.contents)) + throw new Error("unexpected report shape"); + return report; + } catch (err) { + throw new Error( + `claude plugin validate gave no usable report for ${path} (exit ${r.status}): ${err}\n${r.stdout}${r.stderr}` + ); + } +} + +function checkFolder(dir: string): { problems: string[]; name: string | null } { + const manifestPath = join(dir, ".claude-plugin/plugin.json"); + if (!existsSync(manifestPath)) + return { problems: ["no .claude-plugin/plugin.json"], name: null }; + + const problems: string[] = []; + let name: string | null = null; + try { + const manifest = JSON.parse(readFileSync(manifestPath, "utf8")); + const value = manifest?.name; + if (typeof value === "string" && value) name = value; + } catch { + // Not JSON: the CLI reports it below. + } + if (name !== null && name !== basename(dir)) + problems.push(`plugin.json name "${name}" is not the folder's name`); + + for (const file of JSON_FILES) { + const path = join(dir, file); + if (!existsSync(path)) continue; + try { + JSON.parse(readFileSync(path, "utf8")); + } catch (err) { + problems.push(`${file}: not valid JSON (${err})`); + } + } + + const report = cliValidate(dir); + for (const w of report.manifest?.warnings ?? []) + console.log(`warn ${dir} plugin.json ${w.path}: ${w.message}`); + const manifestErrors = report.manifest?.errors ?? []; + // Check 2 judges the name, and can only do so when there is one. + const ignored = name === null ? [] : manifestErrors.filter((e) => e.path === "name"); + const reported = manifestErrors.filter((e) => !ignored.includes(e)); + for (const e of reported) problems.push(`plugin.json ${e.path}: ${e.message}`); + let fileErrors = 0; + for (const f of report.contents) { + for (const e of f.errors) { + fileErrors++; + problems.push(`${f.file} ${e.path}: ${e.message}`); + } + for (const w of f.warnings ?? []) + console.log(`warn ${f.file} ${w.path}: ${w.message}`); + } + // A failure with no error we can name must still fail. + if (!report.success && !ignored.length && !reported.length && !fileErrors) + problems.push("claude plugin validate failed without naming an error"); + + return { problems, name }; +} + +function checkTogether(plugins: { dir: string; name: string }[]): string[] { + const root = mkdtempSync(join(tmpdir(), "plugin-folders-")); + try { + for (const { dir } of plugins) { + mkdirSync(join(root, dirname(dir)), { recursive: true }); + cpSync(dir, join(root, dir), { recursive: true }); + } + const file = join(root, ".claude-plugin/marketplace.json"); + mkdirSync(dirname(file)); + writeFileSync( + file, + JSON.stringify({ + name: MARKETPLACE_NAME, + owner: { name: "Anthropic", email: "support@anthropic.com" }, + plugins: plugins.map(({ dir, name }) => ({ name, source: `./${dir}` })), + }) + ); + const report = cliValidate(file); + const problems = [report.manifest, ...report.contents].flatMap((f) => + (f?.errors ?? []).map((e) => { + // "plugins[4] plugin.json → version" or "plugins.4.name" + const i = /^plugins[[.](\d+)/.exec(e.path)?.[1]; + const dir = i === undefined ? undefined : plugins[Number(i)]?.dir; + return `${dir ? `${dir}: ` : ""}${e.path}: ${e.message}`; + }) + ); + if (!report.success && problems.length === 0) + problems.push("claude plugin validate failed without naming an error"); + return problems; + } finally { + rmSync(root, { recursive: true, force: true }); + } +} + +// Entries of the real marketplace.json whose plugin lives in this repository. +function checkListedFoldersExist(): string[] { + const { plugins } = JSON.parse( + readFileSync(".claude-plugin/marketplace.json", "utf8") + ) as { plugins: { name: string; source: unknown }[] }; + return plugins.flatMap(({ name, source }) => + typeof source === "string" && + !existsSync(join(source, ".claude-plugin/plugin.json")) + ? [`marketplace.json lists "${name}" at ${source}, which has no plugin`] + : [] + ); +} + +const list = run("bash", [".github/scripts/plugin-dirs.sh"]); +if (list.status !== 0) throw new Error(`plugin-dirs.sh failed: ${list.stderr}`); +const dirs = list.stdout.split("\n").filter(Boolean); +if (dirs.length === 0) throw new Error("found no plugin folders"); + +const problems: string[] = []; +const named: { dir: string; name: string }[] = []; +for (const dir of dirs) { + let result: ReturnType<typeof checkFolder>; + try { + result = checkFolder(dir); + } catch (err) { + result = { problems: [String(err)], name: null }; + } + console.log(`${result.problems.length ? "FAIL" : "ok "} ${dir}`); + for (const p of result.problems) problems.push(`${dir}: ${p}`); + if (result.name !== null) named.push({ dir, name: result.name }); +} +for (const check of [() => checkTogether(named), checkListedFoldersExist]) { + try { + problems.push(...check()); + } catch (err) { + problems.push(String(err)); + } +} + +if (problems.length > 0) { + console.log(); + // %0A keeps a multi-line message in one annotation. + for (const p of problems) console.log(`::error::${p.replace(/\r?\n/g, "%0A")}`); + console.log(`\n${problems.length} problem(s) in ${dirs.length} plugin folders.`); + process.exit(1); +} +console.log(`\nAll ${dirs.length} plugin folders are valid.`); diff --git a/.github/workflows/check-mcp-urls.yml b/.github/workflows/check-mcp-urls.yml index a91b312b..c2ad8a9c 100644 --- a/.github/workflows/check-mcp-urls.yml +++ b/.github/workflows/check-mcp-urls.yml @@ -1,14 +1,8 @@ name: Check MCP URLs -# Liveness check for http/sse MCP server URLs declared by plugins vendored -# in this repo. Catches typos in new submissions and upstream endpoints that -# disappear after merge. -# -# Scope: only plugins whose files live in this working tree (marketplace -# entries with a string `source`, e.g. "./plugins/foo"). External entries -# are pinned to an upstream repo at a SHA — reading their .mcp.json would -# mean cloning every upstream on each run, which is slow and flaky. Those -# are out of scope for now. +# Liveness check for http/sse MCP server URLs declared by the plugins in this +# repository (.github/scripts/plugin-dirs.sh). Catches typos, and endpoints +# that disappear after merge. # # What counts as "alive": anything that proves the hostname/path resolves to # a server. 401/403/405/5xx all pass — auth and method errors are expected @@ -17,9 +11,9 @@ name: Check MCP URLs on: pull_request: paths: - - '.claude-plugin/marketplace.json' - 'plugins/**' - 'external_plugins/**' + - '.github/scripts/plugin-dirs.sh' - '.github/workflows/check-mcp-urls.yml' schedule: - cron: '0 6 * * *' @@ -39,16 +33,11 @@ jobs: run: | set -euo pipefail - MARKETPLACE=".claude-plugin/marketplace.json" - - # Each line: "<plugin>\t<server>\t<url>". Marketplace entries with a - # string `source` are local paths; objects describe an external repo - # pinned at a SHA, which we don't have checked out — skip those. + # Each line: "<plugin>\t<server>\t<url>". discover() { - jq -r '.plugins[] | select(.source | type == "string") | "\(.name)\t\(.source)"' "$MARKETPLACE" | - while IFS=$'\t' read -r plugin src; do - dir="${src#./}" - [[ -d "$dir" ]] || continue + bash .github/scripts/plugin-dirs.sh | + while IFS= read -r dir; do + plugin="${dir##*/}" for cfg in "$dir/.mcp.json" "$dir/mcp.json" "$dir/.claude-plugin/plugin.json"; do [[ -f "$cfg" ]] || continue # MCP config comes in two shapes: a bare map of server name -> @@ -108,7 +97,7 @@ jobs: entries="$(discover)" if [[ -z "$entries" ]]; then - echo "::notice::No http/sse MCP server URLs found in vendored plugins." + echo "::notice::No http/sse MCP server URLs found in this repository's plugins." exit 0 fi @@ -121,6 +110,11 @@ jobs: printf '%-24s %-18s %-52s %s\n' "$plugin" "$server" "$url" "SKIP templated" continue fi + # example.com is reserved for documentation, so nothing is ever there. + if [[ "$url" =~ ^https?://([^/:]+\.)?example\.com([/:]|$) ]]; then + printf '%-24s %-18s %-52s %s\n' "$plugin" "$server" "$url" "SKIP example" + continue + fi result="$(probe "$url")" || true printf '%-24s %-18s %-52s %s\n' "$plugin" "$server" "$url" "$result" if [[ "$result" == FAIL* ]]; then diff --git a/.github/workflows/close-external-prs.yml b/.github/workflows/close-external-prs.yml index 21b2e2c7..416bacd0 100644 --- a/.github/workflows/close-external-prs.yml +++ b/.github/workflows/close-external-prs.yml @@ -23,7 +23,7 @@ jobs: script: | const author = context.payload.pull_request.user.login; - const { evaluate, isExemptAuthor } = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/external-pr-scope.js`); + const { evaluate, isExemptAuthor, SUBMISSION_NOTICE } = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/external-pr-scope.js`); // Members (write/admin) and the repo's own automation bot (bump SHA PRs) are never // auto-closed. @@ -41,20 +41,22 @@ jobs: // approval still gate the merge (the External PR Scope Guard is advisory signal, // not a required check). const result = await evaluate({ github, context }); - if (result.ok && result.added.length > 0) { - console.log(`In-scope external contribution (adds: ${result.added.join(', ')}) — allowing PR.`); - return; - } - - console.log(`Closing PR from ${author}: ${result.problems.join('; ') || 'out of scope'}`); + const inScope = result.ok && result.added.length > 0; await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, - body: `Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin [here](https://clau.de/plugin-directory-submission).` + body: inScope ? SUBMISSION_NOTICE : `${SUBMISSION_NOTICE}\n\nThis pull request has been closed automatically, because this repository only takes changes from Anthropic team members.` }); + if (inScope) { + console.log(`In-scope external contribution (adds: ${result.added.join(', ')}) — allowing PR.`); + return; + } + + console.log(`Closing PR from ${author}: ${result.problems.join('; ') || 'out of scope'}`); + await github.rest.pulls.update({ owner: context.repo.owner, repo: context.repo.repo, diff --git a/.github/workflows/external-pr-scope-guard.yml b/.github/workflows/external-pr-scope-guard.yml index 683e178b..41c593cd 100644 --- a/.github/workflows/external-pr-scope-guard.yml +++ b/.github/workflows/external-pr-scope-guard.yml @@ -47,7 +47,8 @@ jobs: if (!result.ok) { core.setFailed( `Scope guard: a non-member PR may only ADD marketplace.json entries whose source repo already backs a live plugin here.\n - ` + - result.problems.join('\n - ') + result.problems.join('\n - ') + + `\nPlugins are submitted at https://claude.ai/directory/manage. Pull requests here are not monitored.` ); return; } diff --git a/.github/workflows/validate-frontmatter.yml b/.github/workflows/validate-frontmatter.yml deleted file mode 100644 index 243455d8..00000000 --- a/.github/workflows/validate-frontmatter.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Validate Frontmatter - -on: - pull_request: - paths: - - '**/agents/*.md' - - '**/skills/*/SKILL.md' - - '**/commands/*.md' - -jobs: - validate: - # Fork PRs are auto-closed by close-external-prs.yml, so skip validation - # for them entirely. This also prevents untrusted filenames from forks - # from ever reaching the shell steps below. - if: github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 (sha-pinned) - - - name: Install dependencies - run: cd .github/scripts && bun install yaml - - - name: Get changed frontmatter files - id: changed - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.pull_request.number }} - run: | - # Use diff-filter=AMRC to exclude deleted files (D) - only Added, Modified, Renamed, Copied - FILES=$(gh pr diff "$PR_NUMBER" --name-only --diff-filter=AMRC | grep -E '(agents/.*\.md|skills/.*/SKILL\.md|commands/.*\.md)$' || true) - echo "files<<EOF" >> "$GITHUB_OUTPUT" - echo "$FILES" >> "$GITHUB_OUTPUT" - echo "EOF" >> "$GITHUB_OUTPUT" - - - name: Validate frontmatter - if: steps.changed.outputs.files != '' - env: - FILES: ${{ steps.changed.outputs.files }} - run: | - printf '%s\n' "$FILES" | xargs bun .github/scripts/validate-frontmatter.ts diff --git a/.github/workflows/validate-plugins.yml b/.github/workflows/validate-plugins.yml index cf4071c1..8be7c60e 100644 --- a/.github/workflows/validate-plugins.yml +++ b/.github/workflows/validate-plugins.yml @@ -1,72 +1,18 @@ 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: - paths: - - '.claude-plugin/**' - - '*/.claude-plugin/**' - - '*/agents/**' - - '*/skills/**' - - '*/commands/**' - # Vendored plugins live TWO levels deep (plugins/<name>/, external_plugins/<name>/), - # and `*` doesn't cross a `/` — so the one-level patterns above never match them. - # Without these, a PR touching only e.g. plugins/<name>/.claude-plugin/plugin.json - # (a manifest version bump) fires nothing and the required `validate` check sits - # "Expected — Waiting for status to be reported" forever (PR #5416 hit this; same - # per-level spell-out as the README/assets entries below). - - 'plugins/*/.claude-plugin/**' - - 'plugins/*/agents/**' - - 'plugins/*/skills/**' - - 'plugins/*/commands/**' - - 'external_plugins/*/.claude-plugin/**' - - 'external_plugins/*/agents/**' - - 'external_plugins/*/skills/**' - - 'external_plugins/*/commands/**' - # `validate` is a required status check, so a PR that touches ONLY workflow - # files (e.g. an action-SHA re-pin) would otherwise never trigger validate - # and sit "Expected — Waiting for status to be reported" forever (workflow_dispatch - # check runs aren't associated with the PR, so they don't satisfy it). Run - # validate on workflow changes too so those PRs can clear the gate in-context. - - '.github/workflows/**' - # Same rationale for the scan policy prompt: a policy-only PR (.github/policy/**) - # touches none of the plugin paths above, so validate would never trigger via - # pull_request and the required check would sit "Expected" forever (a dispatch - # check run isn't associated with the PR, so it can't satisfy the gate either). - - '.github/policy/**' - # Same again for the bump-tracking ledger: a PR that only edits - # .github/bump-tracking.json (e.g. enrolling slugs in releases-only - # tracking) matches nothing above, so the required check sits - # "Expected" forever and even a dispatched validate run on the PR - # head can't satisfy the gate (it only counts pull_request suites). - - '.github/bump-tracking.json' - # And once more for a plugin's own docs: a PR that only edits a README or - # adds a screenshot matches nothing above, so the required check never - # reports and the PR can't be merged. Spelled out per level because `*` - # doesn't cross a `/` — plugins live at plugins/<name>/, so `*/README.md` - # would not match one. - - 'plugins/*/README.md' - - 'plugins/*/assets/**' - - 'external_plugins/*/README.md' - - 'external_plugins/*/assets/**' - # And for a vendored plugin's MCP server config / hooks: a PR that only edits - # plugins/<name>/.mcp.json (e.g. repointing a partner's remote MCP URL, as - # #4985 and its follow-up did for context7) or a hooks file matches nothing - # above, so `validate` never reports and the PR sits "Expected" forever. - - 'plugins/*/.mcp.json' - - 'plugins/*/hooks/**' - - 'external_plugins/*/.mcp.json' - - 'external_plugins/*/hooks/**' push: branches: [main] - paths: - - '.claude-plugin/**' - # `validate` is a required status check on main. Bump PRs are opened with - # GITHUB_TOKEN, which doesn't fire on:pull_request (recursion guard), so the - # path-filtered trigger above never reports on them and the PR would be - # blocked forever. The bump workflow dispatches this against each per-entry - # bump branch instead; the check run lands on the branch HEAD (= PR head) - # and satisfies the required check. The validate job runs unconditionally, - # so a dispatch always reports. + # 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: @@ -75,17 +21,68 @@ permissions: jobs: validate: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: anthropics/claude-plugins-community/.github/actions/validate-plugins@163301d1904c0a994539f5226ce0fcd65b8652bf + - 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 - # Official curated marketplace: SHA-pin (I5) is a HARD error. - # I8/I11 are warnings until the 15 known vendored-path/name issues - # are cleaned up (see PR body); tighten to "I1 I3" after. + 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 |
