|
| 1 | +name: import-external-skills |
| 2 | + |
| 3 | +# Manually-dispatched workflow that refreshes the federated portion of the |
| 4 | +# catalog. It reads `catalog/sources.yml`, shallow-clones each declared |
| 5 | +# source, vendors the named skills into `skills/<name>/`, updates |
| 6 | +# `.claude-plugin/marketplace.json`, regenerates the Cursor manifest, and |
| 7 | +# opens a pull request with the result. Every imported skill goes through |
| 8 | +# the same `validate` checks as in-repo skills before it lands on `main`. |
| 9 | +# |
| 10 | +# See `catalog/README.md` for the federation design. |
| 11 | + |
| 12 | +on: |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + dry_run: |
| 16 | + description: "Resolve sources and print planned changes without committing." |
| 17 | + required: false |
| 18 | + type: boolean |
| 19 | + default: false |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + pull-requests: write |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: import-external-skills |
| 27 | + cancel-in-progress: false |
| 28 | + |
| 29 | +jobs: |
| 30 | + import: |
| 31 | + name: Import external skills |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Check out repository |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Set up uv |
| 38 | + uses: astral-sh/setup-uv@v7 |
| 39 | + |
| 40 | + - name: Configure git for sparse-checkout |
| 41 | + run: | |
| 42 | + git --version |
| 43 | + git config --global init.defaultBranch main |
| 44 | +
|
| 45 | + - name: Import skills declared in catalog/sources.yml |
| 46 | + id: import |
| 47 | + run: | |
| 48 | + if [ "${{ inputs.dry_run }}" = "true" ]; then |
| 49 | + uv run scripts/import_external_skills.py --dry-run |
| 50 | + else |
| 51 | + uv run scripts/import_external_skills.py |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: Regenerate Cursor plugin manifest |
| 55 | + if: ${{ inputs.dry_run != true }} |
| 56 | + run: uv run scripts/generate_cursor_plugin.py |
| 57 | + |
| 58 | + - name: Validate skills and manifests |
| 59 | + if: ${{ inputs.dry_run != true }} |
| 60 | + run: ./scripts/check.sh |
| 61 | + |
| 62 | + - name: Detect changes |
| 63 | + if: ${{ inputs.dry_run != true }} |
| 64 | + id: changes |
| 65 | + run: | |
| 66 | + if [ -z "$(git status --porcelain)" ]; then |
| 67 | + echo "changed=false" >> "$GITHUB_OUTPUT" |
| 68 | + echo "No changes to import. Skipping PR." |
| 69 | + else |
| 70 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 71 | + git status --short |
| 72 | + fi |
| 73 | +
|
| 74 | + # Use the GitHub-maintained action to push to a dedicated branch and |
| 75 | + # open a PR. PRs (rather than direct commits to main) keep imported |
| 76 | + # changes reviewable and let the standard `validate` workflow gate |
| 77 | + # them. |
| 78 | + - name: Open pull request with imported skills |
| 79 | + if: ${{ inputs.dry_run != true && steps.changes.outputs.changed == 'true' }} |
| 80 | + uses: peter-evans/create-pull-request@v7 |
| 81 | + with: |
| 82 | + branch: bot/import-external-skills |
| 83 | + delete-branch: true |
| 84 | + commit-message: "chore(catalog): refresh federated skills from catalog/sources.yml" |
| 85 | + title: "Refresh federated skills" |
| 86 | + body: | |
| 87 | + Automated import driven by `catalog/sources.yml`. |
| 88 | +
|
| 89 | + See `catalog/README.md` for the federation design. Each vendored |
| 90 | + skill includes a `.federated.json` marker recording the source |
| 91 | + repo, pinned ref, and resolved commit at import time. |
| 92 | +
|
| 93 | + Triggered by @${{ github.actor }} via the `import-external-skills` |
| 94 | + workflow ([run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})). |
| 95 | + labels: | |
| 96 | + catalog |
| 97 | + automated |
| 98 | + add-paths: | |
| 99 | + catalog/** |
| 100 | + skills/** |
| 101 | + .claude-plugin/** |
| 102 | + .cursor-plugin/** |
0 commit comments