-
Notifications
You must be signed in to change notification settings - Fork 8
feat(docs): Agent Skills registry and Templates gallery (rebuild of #36) #88
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
base: main
Are you sure you want to change the base?
Changes from all commits
37b20f4
20f0acd
dbcad51
39e012c
df9cb5d
38d8046
597c163
0db955e
4c3b462
67fdc59
6148f6d
a16968d
06212f3
6e5f3d6
c5a4a92
d23655e
4eabc00
c18b174
ad59fb2
51ffa82
4524e1b
d6905d0
6ada975
0faf74a
6385c8b
239721b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| name: Sync agent skills from sei-skill | ||
|
|
||
| # The installable agent skills at .mintlify/skills/<name>/SKILL.md are GENERATED | ||
| # from the canonical sei-skill repo (github.com/sei-protocol/sei-skill) by | ||
| # scripts/build-mintlify-skills.mjs — they are never hand-authored here. This | ||
| # workflow regenerates them and opens a PR for review (generation is LLM-assisted | ||
| # and non-deterministic, so a human reviews before merge). | ||
| # | ||
| # Triggers: | ||
| # - workflow_dispatch (manual; optionally pass a sei-skill ref) | ||
| # - repository_dispatch (sei-skill's release workflow sends type: sei-skill-release | ||
| # with client_payload.ref = the released tag/sha) | ||
| # | ||
| # Requires repo secret ANTHROPIC_API_KEY and repo variable ANTHROPIC_MODEL (a | ||
| # current model ID). | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: 'sei-skill ref to generate from' | ||
| required: false | ||
| default: 'main' | ||
| repository_dispatch: | ||
| types: [sei-skill-release] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| sync: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| steps: | ||
| - name: Checkout docs | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Checkout sei-skill (canonical source) | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: sei-protocol/sei-skill | ||
| ref: ${{ github.event.client_payload.ref || inputs.ref || 'main' }} | ||
| path: .sei-skill-src | ||
|
|
||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install generator dependency | ||
| run: npm install --no-save @anthropic-ai/sdk@0.129.0 | ||
|
|
||
| - name: Record sei-skill revision | ||
| id: src | ||
| run: echo "ref=$(git -C .sei-skill-src rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Regenerate skills from sei-skill | ||
| env: | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| ANTHROPIC_MODEL: ${{ vars.ANTHROPIC_MODEL }} | ||
| SEI_SKILL_DIR: ${{ github.workspace }}/.sei-skill-src/skill | ||
| SEI_SKILL_REF: ${{ steps.src.outputs.ref }} | ||
| run: node scripts/build-mintlify-skills.mjs --write | ||
|
|
||
| - name: Clean up source + build dirs | ||
| run: rm -rf .sei-skill-src dist | ||
|
|
||
| # PRs opened with GITHUB_TOKEN don't trigger other workflows, so the sync PR | ||
| # never runs validate-docs.yml or link-check.yml. Run their skill checks here. | ||
| - name: Validate regenerated skills | ||
| run: | | ||
| node scripts/check-skills.mjs | ||
| npx --yes mint@4.2.952 broken-links | ||
|
|
||
| - name: Open PR if skills changed | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Stage first: `git diff --quiet` ignores untracked files, so a brand-new | ||
| # skill (or a first run into an empty .mintlify/skills/) would be missed. | ||
| git add .mintlify/skills | ||
| if git diff --cached --quiet; then | ||
| echo 'No skill changes; nothing to do.' | ||
| exit 0 | ||
| fi | ||
| BRANCH="chore/sync-skills-${{ steps.src.outputs.ref }}" | ||
| # A reviewer may have pushed fixups to an open sync PR for this ref; | ||
| # a force-push would silently discard them. | ||
| if [[ -n "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]]; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] This only checks for an open PR from the branch for the same ref. When a new sei-skill release dispatches while an older sync PR is still open, a second PR opens and the two overlap on the same files. Consider closing or superseding any open
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [suggestion] (Also raised by Codex.) The |
||
| echo "An open PR already syncs sei-skill@${{ steps.src.outputs.ref }}; leaving it untouched." | ||
| exit 0 | ||
| fi | ||
| git config user.name 'github-actions[bot]' | ||
| git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
| git checkout -b "$BRANCH" | ||
| git commit -m "chore(skills): regenerate from sei-skill@${{ steps.src.outputs.ref }}" | ||
| # Overwrites a leftover branch from a closed sync PR for the same ref. | ||
| git push -f origin "$BRANCH" | ||
| new_pr=$(gh pr create \ | ||
| --title "chore(skills): regenerate from sei-skill@${{ steps.src.outputs.ref }}" \ | ||
| --body "Automated regeneration of \`.mintlify/skills/\` from [sei-protocol/sei-skill](https://github.com/sei-protocol/sei-skill)@${{ steps.src.outputs.ref }} via \`scripts/build-mintlify-skills.mjs\`. These are generated artifacts — review for quality before merge.") | ||
| # Close open sync PRs for older refs, so two PRs never rewrite the same skills. | ||
| # Their branches stay, so a reviewer's fixups there can still be ported. | ||
| gh pr list --state open --limit 100 --json number,headRefName | | ||
| jq -r --arg branch "$BRANCH" '.[] | select((.headRefName | startswith("chore/sync-skills-")) and .headRefName != $branch) | .number' | | ||
| while read -r number; do | ||
| gh pr close "$number" --comment "Superseded by $new_pr, which syncs sei-skill@${{ steps.src.outputs.ref }}. This branch is kept, so any fixups here can be ported." | ||
| done | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion] The branch push and
gh pr createboth usegithub.token, and events created withGITHUB_TOKENdon't trigger otherpush/pull_requestworkflows. The generated sync PRs would therefore skipvalidate-docs.yml(the generated-marker and registry checks) andlink-check.yml(MDX parse). That's the review gate this PR relies on for LLM output. Use a GitHub App or PAT token, or run the validation steps inline in this job before opening the PR.