|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
| 7 | + paths: |
| 8 | + - 'openapi.json' |
| 9 | + - 'scripts/generate-types.mjs' |
| 10 | + - 'scripts/prettify-base-json.mjs' |
| 11 | + - '.github/workflows/generate.yml' |
7 | 12 | schedule: |
8 | 13 | # At 06:37 on every day-of-week from Monday through Friday. |
9 | 14 | - cron: '37 6 * * 1-5' |
10 | 15 | workflow_dispatch: |
| 16 | + inputs: |
| 17 | + force: |
| 18 | + description: 'Force regeneration even if no changes detected' |
| 19 | + required: false |
| 20 | + default: false |
| 21 | + type: boolean |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: write |
| 25 | + pull-requests: write |
11 | 26 |
|
12 | 27 | permissions: |
13 | 28 | contents: write |
|
24 | 39 | branch-name: 'automated/open-api' |
25 | 40 | commit-message: 'fix(openapi): sync with openapi definition' |
26 | 41 | pr-title: 'Sync with OpenAPI definition' |
27 | | - pr-body: 'The OpenAPI definition in the API has been updated. This PR downloads the latest one and regenerates the SDK.' |
| 42 | + pr-body: | |
| 43 | + ## 🔄 OpenAPI Sync |
| 44 | +
|
| 45 | + The OpenAPI definition in the API has been updated. This PR automatically: |
| 46 | + - Downloads the latest OpenAPI specification |
| 47 | + - Regenerates TypeScript types |
| 48 | + - Updates SDK method signatures if needed |
| 49 | +
|
| 50 | + ### What's Changed |
| 51 | + See the file changes below for specific updates to the API types and methods. |
| 52 | +
|
| 53 | + ⚠️ **Please review carefully for any breaking changes in the API.** |
28 | 54 | npm-post-sync-script: 'generate-sdk' |
| 55 | + |
| 56 | + validate: |
| 57 | + name: Validate generated SDK |
| 58 | + needs: fetch_and_update |
| 59 | + if: success() |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 |
| 63 | + with: |
| 64 | + ref: automated/open-api |
| 65 | + |
| 66 | + - uses: SocketDev/socket-sdk-js/.github/actions/setup@e8ae193eb686db288e09cbacce75a828681ccae9 |
| 67 | + with: |
| 68 | + node-version: '22' |
| 69 | + |
| 70 | + - name: Validate TypeScript types |
| 71 | + run: pnpm run check:tsc |
| 72 | + |
| 73 | + - name: Run tests |
| 74 | + run: pnpm test |
| 75 | + |
| 76 | + - name: Check for breaking changes |
| 77 | + run: | |
| 78 | + if git diff origin/main...HEAD --name-only | grep -q 'types/api.d.ts'; then |
| 79 | + echo "⚠️ API types have changed. Please review for breaking changes." |
| 80 | + git diff origin/main...HEAD types/api.d.ts | head -100 |
| 81 | + fi |
0 commit comments