Skip to content

Commit 7c77c90

Browse files
George-iamclaude
andcommitted
feat(ci): auto-open marketplace bump PR after plugin sync
Closes the last automatable mile of the Claude Code plugin channel. `claude plugin install axme-code@claude-community` installs the SHA pinned in anthropics/claude-plugins-community, not our plugin repo HEAD — and through April-June 2026 that pin silently stayed at v0.2.9 because bumping it was a manual PR no process owned. New open-marketplace-pr job (needs: sync-plugin-repo): - reads the fresh AxmeAI/axme-code-plugin HEAD and the currently pinned SHA from upstream marketplace.json; no-ops when equal - branches off UPSTREAM main in the AxmeAI fork (one-line diff regardless of fork staleness), replaces the SHA with a count==1 + JSON-parse assertion, force-pushes the standing `bump-axme-code` branch - updates any open bump PR in place, else creates one — consecutive releases never stack duplicate PRs The Anthropic maintainers' review/merge stays manual by design (their supply-chain gate). release.sh postflight still verifies the pin, so a stalled upstream PR is loudly visible at the next release. Token note: uses MARKETPLACE_PR_TOKEN if set, else PLUGIN_REPO_TOKEN. Creating PRs on a foreign public repo requires a classic PAT scope (public_repo); if PLUGIN_REPO_TOKEN is fine-grained to the plugin repo only, add MARKETPLACE_PR_TOKEN. YAML validated; embedded script passes bash -n. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5954c85 commit 7c77c90

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/release-binary.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,86 @@ jobs:
196196
git add -A
197197
git commit -m "sync: ${GITHUB_REF_NAME} from axme-code" || echo "No changes to commit"
198198
git push
199+
200+
open-marketplace-pr:
201+
# Final mile of the Claude Code plugin channel. `claude plugin install
202+
# axme-code@claude-community` installs the commit SHA pinned in
203+
# anthropics/claude-plugins-community — NOT our plugin repo HEAD. Through
204+
# April–June 2026 that pin silently stayed at v0.2.9 because bumping it
205+
# was a manual PR that no process owned. This job opens (or updates) the
206+
# bump PR automatically after every successful sync. Anthropic
207+
# maintainers still review and merge it — that part is their
208+
# supply-chain gate and cannot (and should not) be automated away.
209+
#
210+
# Idempotency: a single standing branch `bump-axme-code` on the AxmeAI
211+
# fork is force-pushed each release. If a bump PR is already open, the
212+
# push updates it in place; otherwise a new PR is created. Consecutive
213+
# releases before a merge therefore never stack duplicate PRs.
214+
#
215+
# Token: needs push access to the AxmeAI/claude-plugins-community fork
216+
# AND permission to open PRs on the public upstream — a classic PAT
217+
# with `public_repo`/`repo` scope (fine-grained PATs cannot create PRs
218+
# on repos outside their owner). Falls back to PLUGIN_REPO_TOKEN; if
219+
# that one is fine-grained to axme-code-plugin only, add a
220+
# MARKETPLACE_PR_TOKEN secret.
221+
needs: sync-plugin-repo
222+
runs-on: ubuntu-latest
223+
permissions:
224+
contents: read
225+
steps:
226+
- name: Open or update marketplace bump PR
227+
env:
228+
GH_TOKEN: ${{ secrets.MARKETPLACE_PR_TOKEN || secrets.PLUGIN_REPO_TOKEN }}
229+
run: |
230+
set -euo pipefail
231+
version="${GITHUB_REF_NAME#v}"
232+
new_sha="$(gh api repos/AxmeAI/axme-code-plugin/commits/main --jq .sha)"
233+
234+
old_sha="$(curl -fsSL https://raw.githubusercontent.com/anthropics/claude-plugins-community/main/.claude-plugin/marketplace.json \
235+
| jq -r '.plugins[] | select(.name == "axme-code") | .source.sha')"
236+
if [ -z "$old_sha" ] || [ "$old_sha" = "null" ]; then
237+
echo "::error::Could not read the current axme-code pin from upstream marketplace.json"
238+
exit 1
239+
fi
240+
if [ "$old_sha" = "$new_sha" ]; then
241+
echo "Marketplace pin already current ($new_sha) — nothing to do."
242+
exit 0
243+
fi
244+
245+
# Branch off upstream main so the PR diff is exactly one line,
246+
# regardless of how stale our fork's main is.
247+
git clone --depth 1 "https://x-access-token:${GH_TOKEN}@github.com/AxmeAI/claude-plugins-community.git" fork
248+
cd fork
249+
git fetch --depth 1 https://github.com/anthropics/claude-plugins-community.git main
250+
git checkout -B bump-axme-code FETCH_HEAD
251+
252+
python3 - "$old_sha" "$new_sha" <<'PY'
253+
import json, sys
254+
old, new = sys.argv[1], sys.argv[2]
255+
path = ".claude-plugin/marketplace.json"
256+
raw = open(path).read()
257+
count = raw.count(old)
258+
assert count == 1, f"expected pinned SHA exactly once in marketplace.json, found {count}"
259+
updated = raw.replace(old, new)
260+
entry = [p for p in json.loads(updated)["plugins"] if p["name"] == "axme-code"][0]
261+
assert entry["source"]["sha"] == new, "axme-code entry not updated correctly"
262+
open(path, "w").write(updated)
263+
print(f"pin {old[:7]} -> {new[:7]} OK")
264+
PY
265+
266+
git config user.name "github-actions"
267+
git config user.email "github-actions@github.com"
268+
git add .claude-plugin/marketplace.json
269+
git commit -m "Update axme-code to v${version}"
270+
git push -f origin bump-axme-code
271+
272+
open_prs="$(gh pr list --repo anthropics/claude-plugins-community \
273+
--head AxmeAI:bump-axme-code --state open --json number --jq 'length')"
274+
if [ "$open_prs" -gt 0 ]; then
275+
echo "Existing bump PR updated in place via force-push."
276+
else
277+
gh pr create --repo anthropics/claude-plugins-community \
278+
--base main --head AxmeAI:bump-axme-code \
279+
--title "Update axme-code to v${version}" \
280+
--body "$(printf 'Bumps the pinned SHA for **axme-code** to the v%s sync commit ([`%s`](https://github.com/AxmeAI/axme-code-plugin/commit/%s)) of AxmeAI/axme-code-plugin.\n\nOne-line diff — only the existing entry'"'"'s `source.sha` changes. Opened automatically by the axme-code release workflow; maintained by the AxmeAI org (plugin author).' "$version" "${new_sha:0:7}" "$new_sha")"
281+
fi

0 commit comments

Comments
 (0)