Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/sync-release-chores.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Sync release chores

# Runs on the rolling skills Sync PR.
# Bumps the plugin version and updates CHANGELOG.md on the same branch.
# Files outside skills/ survive later syncs (docs/skills-sync.md, "Human commits on the Sync Branch").

on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]

permissions:
contents: read

concurrency:
group: sync-release-chores-${{ github.head_ref }}
cancel-in-progress: true

jobs:
bump:
if: github.head_ref == 'automated/skills-sync' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
# A push made with GITHUB_TOKEN would not trigger CI on the PR, so use an App token.
- uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
id: app-token
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}

- uses: actions/checkout@v7
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-node@v7
with:
node-version: 24

- name: Bump version and changelog
env:
BASE_REF: origin/${{ github.base_ref }}
run: node scripts/bump-plugin-version.mjs

- name: Validate plugin
run: npx --yes @anthropic-ai/claude-code@latest plugin validate . --strict

- name: Commit
run: |
if git diff --quiet; then
echo "Nothing to bump"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am "chore(plugin): bump version for skills sync"
git push
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dist/
.sync-notes.md
.DS_Store
68 changes: 68 additions & 0 deletions scripts/bump-plugin-version.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Sets every plugin manifest to base version + 1 (patch) and writes the matching CHANGELOG entry.
// Idempotent: the target is derived from the base branch, so re-running on a re-synced PR
// rewrites the same version and replaces the same changelog entry.
import { execFileSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";

const BASE_REF = process.env.BASE_REF ?? "origin/main";
// .claude-plugin/plugin.json is the source of truth; the others are kept equal to it.
const SOURCE = ".claude-plugin/plugin.json";
const MANIFESTS = [
"plugin.json",
SOURCE,
".cursor-plugin/plugin.json",
".github/plugin/plugin.json",
"gemini-extension.json",
"server.json",
];

const git = (...args) => execFileSync("git", args, { encoding: "utf8" }).trim();

const skillChanges = git("diff", "--name-status", `${BASE_REF}...HEAD`, "--", "skills/")
.split("\n")
.filter(Boolean)
.map((line) => {
const [status, path] = line.split("\t");
return { status, name: path.split("/")[1] };
});

if (skillChanges.length === 0) {
console.log("No skill changes against base, nothing to bump");
process.exit(0);
}

const baseVersion = JSON.parse(git("show", `${BASE_REF}:${SOURCE}`)).version;
const [major, minor, patch] = baseVersion.split(".").map(Number);
const next = `${major}.${minor}.${patch + 1}`;

for (const file of MANIFESTS) {
const json = JSON.parse(readFileSync(file, "utf8"));
json.version = next;
writeFileSync(file, `${JSON.stringify(json, null, 2)}\n`);
}

const names = (statuses) =>
[...new Set(skillChanges.filter((c) => statuses.includes(c.status[0])).map((c) => c.name))].sort();
const lines = [
["Added", names(["A"])],
["Updated", names(["M", "R"])],
["Removed", names(["D"])],
]
.filter(([, list]) => list.length)
.map(([label, list]) => `- ${label}: ${list.join(", ")}`);

const changelog = readFileSync("CHANGELOG.md", "utf8");
const heading = `## v${next}`;
const existing = changelog.match(new RegExp(`^${heading.replace(".", "\\.")} — (\\S+)$`, "m"));
// Keep the original date when replacing, so a re-run on another day does not create a diff.
const date = existing?.[1] ?? new Date().toISOString().slice(0, 10);
const entry = `${heading} — ${date}\n${lines.join("\n")}\n\n`;

const withoutOld = changelog.replace(
new RegExp(`^${heading.replace(".", "\\.")} — .*?\\n\\n(?=## |$)`, "ms"),
"",
);
const [title, ...rest] = withoutOld.split("\n\n");
writeFileSync("CHANGELOG.md", `${title}\n\n${entry}${rest.join("\n\n")}`);

console.log(`Bumped ${baseVersion} -> ${next}`);
38 changes: 0 additions & 38 deletions scripts/lib/hash.mjs

This file was deleted.

200 changes: 0 additions & 200 deletions scripts/sync-skills.mjs

This file was deleted.

21 changes: 0 additions & 21 deletions skills.lock.json

This file was deleted.