Update Skills #7
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
| name: Update Skills | |
| # Refreshes vendored skills.sh skills (those tracked by a skills-lock.json, | |
| # managed by https://github.com/vercel-labs/skills) to their latest upstream | |
| # versions and opens a pull request when anything changed. | |
| # | |
| # scripts/update-skills.ts walks every skills-lock.json in the repo and runs the | |
| # skills CLI to pull the latest content; the PR carries a conventional `fix:` | |
| # commit so release-please bumps each affected plugin on merge. | |
| # | |
| # Uses a GitHub App token (the same APP_ID/PRIVATE_KEY as release-please) so the | |
| # pull request triggers CI. When those secrets are absent the job no-ops. | |
| on: | |
| schedule: | |
| # Weekly, Monday 06:00 UTC. | |
| - cron: '0 6 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: update-skills | |
| cancel-in-progress: false | |
| jobs: | |
| update-skills: | |
| name: Update vendored skills | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Verify GitHub App credentials are configured | |
| id: guard | |
| env: | |
| APP_ID: ${{ secrets.APP_ID }} | |
| PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
| run: | | |
| if [ -z "$APP_ID" ] || [ -z "$PRIVATE_KEY" ]; then | |
| echo "::warning::APP_ID/PRIVATE_KEY secrets are not set — skipping skills update" | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Generate GitHub App token | |
| if: steps.guard.outputs.skip != 'true' | |
| id: app-token | |
| uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.PRIVATE_KEY }} | |
| - name: Checkout code | |
| if: steps.guard.outputs.skip != 'true' | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Setup Node.js | |
| if: steps.guard.outputs.skip != 'true' | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Setup Bun | |
| if: steps.guard.outputs.skip != 'true' | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 | |
| with: | |
| bun-version-file: 'package.json' | |
| - name: Install dependencies | |
| if: steps.guard.outputs.skip != 'true' | |
| run: bun install --frozen-lockfile | |
| - name: Update skills | |
| if: steps.guard.outputs.skip != 'true' | |
| id: update | |
| run: bun scripts/update-skills.ts | |
| - name: Build pull request body | |
| if: steps.guard.outputs.skip != 'true' && steps.update.outputs.changed == 'true' | |
| id: body | |
| env: | |
| CHANGED_DIRS: ${{ steps.update.outputs.changed_dirs }} | |
| run: | | |
| { | |
| echo 'body<<EOF' | |
| echo 'Automated refresh of vendored [skills.sh](https://github.com/vercel-labs/skills) skills to their latest upstream versions.' | |
| echo '' | |
| echo 'Updated lock directories:' | |
| IFS=',' read -ra DIRS <<< "$CHANGED_DIRS" | |
| for d in "${DIRS[@]}"; do | |
| [ "$d" = "." ] && d='(repo root)' | |
| echo "- \`$d\`" | |
| done | |
| echo '' | |
| echo 'Generated by `.github/workflows/update-skills.yml` → `scripts/update-skills.ts`.' | |
| echo EOF | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Create pull request | |
| if: steps.guard.outputs.skip != 'true' && steps.update.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| branch: chore/update-skills | |
| delete-branch: true | |
| commit-message: 'fix: update vendored skills to latest versions' | |
| title: 'fix: update vendored skills to latest versions' | |
| body: ${{ steps.body.outputs.body }} | |
| labels: dependencies |