Repository navigation
chore(plugin): get the plugin ready for Claude's plugin directory #1685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: Plugin mirror | ||
|
|
||
| # Claude's plugin directory cannot validate this repository: its GitHub archive | ||
| # is over the directory's 50 MiB limit without the `export-ignore` rule in | ||
| # .gitattributes, and the directory refuses any repository whose .gitattributes | ||
| # uses `export-ignore` at all. A plugin in a subfolder is also always held for a | ||
| # reviewer. So the plugin is submitted from a small repository of its own, | ||
| # getopenscreen/openscreen-plugin, that holds plugin/ at its root. | ||
| # | ||
| # plugin/ stays the source of truth: never edit the mirror by hand, every push | ||
| # here overwrites it. The directory rescans the mirror on each push to it. | ||
| # | ||
| # Setup (once): create getopenscreen/openscreen-plugin, add a deploy key with | ||
| # write access to it, and store the private key here as the | ||
| # PLUGIN_MIRROR_DEPLOY_KEY secret. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - "plugin/**" | ||
| - "LICENSE" | ||
| - "package.json" | ||
| - ".github/workflows/plugin-mirror.yml" | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - "plugin/**" | ||
| - "package.json" | ||
| - ".github/workflows/plugin-mirror.yml" | ||
| workflow_dispatch: | ||
|
|
||
| # Publishing runs (pushes and dispatches on main) queue in one group; every | ||
| # other run gets a group of its own, so it can never take the place of a | ||
| # pending publication. | ||
| concurrency: | ||
| group: plugin-mirror-${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && 'publish' || github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| mirror: | ||
| name: Check and mirror the plugin | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # A publishing run builds from main's tip, not from the commit that queued | ||
| # it, so a run that starts late can never put older content back. | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && 'main' || '' }} | ||
|
|
||
| # The directory only publishes a new version when `version` goes up, so | ||
| # the plugin's version follows the app's, released together. | ||
| - name: Check the plugin's version matches the app's | ||
| run: | | ||
| node -e ' | ||
| const read = (f) => JSON.parse(require("fs").readFileSync(f, "utf8")); | ||
| const app = read("package.json").version; | ||
| const bad = ["plugin/.claude-plugin/plugin.json", "plugin/.codex-plugin/plugin.json"] | ||
| .map((f) => [f, read(f).version]) | ||
| .filter(([, v]) => v !== app); | ||
| for (const [f, v] of bad) console.log(`::error file=${f}::version is ${v}, the app is ${app}`); | ||
| process.exit(bad.length ? 1 : 0); | ||
| ' | ||
|
|
||
| - name: Build the mirror's tree | ||
| run: | | ||
| mkdir -p "$RUNNER_TEMP/mirror" "$RUNNER_TEMP/tree" | ||
| # evals/ is development tooling (prompts, graders, mocks) and does not | ||
| # ship to users. | ||
| cp -a plugin/. "$RUNNER_TEMP/tree/" | ||
| rm -rf "$RUNNER_TEMP/tree/evals" | ||
| cp LICENSE "$RUNNER_TEMP/tree/LICENSE" | ||
|
|
||
| - name: Push to getopenscreen/openscreen-plugin | ||
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'getopenscreen/openscreen' | ||
| env: | ||
| DEPLOY_KEY: ${{ secrets.PLUGIN_MIRROR_DEPLOY_KEY }} | ||
| run: | | ||
| if [ -z "$DEPLOY_KEY" ]; then | ||
| echo "::warning::PLUGIN_MIRROR_DEPLOY_KEY is not set, so the mirror was not updated." | ||
| exit 0 | ||
| fi | ||
| install -m 700 -d ~/.ssh | ||
| printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/mirror_key | ||
| chmod 600 ~/.ssh/mirror_key | ||
| ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null | ||
| export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o IdentitiesOnly=yes" | ||
|
|
||
| cd "$RUNNER_TEMP/mirror" | ||
| if git clone --depth 1 git@github.com:getopenscreen/openscreen-plugin.git repo 2>/dev/null; then | ||
| cd repo | ||
| else | ||
| mkdir repo && cd repo && git init -q -b main | ||
| git remote add origin git@github.com:getopenscreen/openscreen-plugin.git | ||
| fi | ||
| find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} + | ||
| cp -a "$RUNNER_TEMP/tree/." . | ||
| git add -A | ||
| if git diff --cached --quiet; then | ||
| echo "The mirror is already up to date." | ||
| exit 0 | ||
| fi | ||
| git -c user.name="github-actions[bot]" \ | ||
| -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \ | ||
| commit -q -m "Mirror plugin/ from getopenscreen/openscreen@${GITHUB_SHA::7}" | ||
| git push origin HEAD:main | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.