-
Notifications
You must be signed in to change notification settings - Fork 271
Improve skills-sync automation and block manual edits #427
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
Changes from all commits
edf2310
39607dd
0cb19e4
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # Auto-request reviews for skill changes | ||
| # Any PR that modifies skills will automatically request reviews from these users | ||
|
|
||
| /skills/ @stevekaliski-stripe @matv-stripe @sgr-stripe @jleong-stripe @tomchen-stripe | ||
| /providers/*/plugin/skills/ @stevekaliski-stripe @matv-stripe @sgr-stripe @jleong-stripe @tomchen-stripe | ||
| # Skills were previously reviewed here, but are now managed internally. | ||
| # No other directories were marked for CODEOWNER review, but if we do so | ||
| # in the future, the appropriate user list is: | ||
| # | ||
| # @anirudhgoyal-stripe @gusnguyen-stripe @jleong-stripe @johno-stripe @keshavc-stripe @markguan-stripe @matv-stripe @sgr-stripe @vncz-stripe |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Guard synced skills | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'skills/**' | ||
| - '!skills/README.md' | ||
| - 'providers/claude/plugin/skills/**' | ||
| - 'providers/cursor/plugin/skills/**' | ||
|
|
||
| jobs: | ||
| block: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v3 | ||
| with: | ||
| client-id: ${{ secrets.GH_APP_STRIPE_AI_SYNC_CLIENT_ID }} | ||
| private-key: ${{ secrets.GH_APP_STRIPE_AI_SYNC_PEM }} | ||
| owner: ${{ github.repository_owner }} | ||
| repositories: ${{ github.event.repository.name }} | ||
| permission-pull-requests: write | ||
|
|
||
| - name: Build review body | ||
| id: message | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const author = context.payload.pull_request.user.login; | ||
| const isInternal = author.endsWith('-stripe'); | ||
|
|
||
| const action = isInternal | ||
| ? 'To make lasting changes, apply them to the source. You can find instructions at [go/add-stripe-skill](http://go/add-stripe-skill).' | ||
| : 'These changes need to be applied internally. Tagging @stripe/developer-ai to take a look.'; | ||
|
|
||
| const body = [ | ||
| 'This PR modifies files that are automatically synced from a centrally maintained copy at [docs.stripe.com/.well-known/skills](https://docs.stripe.com/.well-known/skills/index.json). Any changes made here will be overwritten by the next sync.', | ||
| '', | ||
| action, | ||
| ].join('\n'); | ||
|
|
||
| core.setOutput('body', body); | ||
|
|
||
| - name: Request changes on PR | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| PR_URL: ${{ github.event.pull_request.html_url }} | ||
| run: gh pr review "$PR_URL" --request-changes --body "${{ steps.message.outputs.body }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,40 +37,15 @@ jobs: | |
| node-version: '20' | ||
|
|
||
| - name: Run sync script | ||
| run: node skills/sync.js | ||
|
|
||
| - name: Verify provider skill directories match source | ||
| run: | | ||
| out_of_sync=false | ||
|
|
||
| for provider in claude cursor; do | ||
| target="providers/$provider/plugin/skills" | ||
|
|
||
| for skill_dir in skills/*/; do | ||
| skill_name="$(basename "$skill_dir")" | ||
| diff -r "skills/$skill_name" "$target/$skill_name" > /dev/null 2>&1 || { | ||
| echo "❌ $target/$skill_name is out of sync with skills/$skill_name" | ||
|
Comment on lines
-42
to
-52
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. quick question - are we getting rid of this CI test?
Contributor
Author
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. Yeah -- it seems like the test was there to pick up when a user changed something in We could technically keep it, but it feels logically dead, so it felt simpler to clean out the last holdover from the previous approach! Happy to bring it back if you think otherwise, though 👍 |
||
| diff -r "skills/$skill_name" "$target/$skill_name" || true | ||
| out_of_sync=true | ||
| } | ||
| done | ||
| done | ||
|
|
||
| if [ "$out_of_sync" = true ]; then | ||
| echo "" | ||
| echo "Fix: run ./scripts/sync-skills.sh and commit the result." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ All provider skill directories are in sync." | ||
| run: node scripts/sync.js | ||
|
|
||
| - name: Push to Github | ||
| if: | | ||
| github.ref == 'refs/heads/main'&& | ||
| !github.event.repository.fork | ||
| shell: bash | ||
| run: | | ||
| git add -u | ||
| git add ':(glob)**/skills/' | ||
|
|
||
| # Skip if nothing changed | ||
| if git diff --staged --quiet; then | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.