schema #243
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: schema | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| schema: | |
| name: Schema | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| checks: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 | |
| - name: Use node 22 | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build packages | |
| # update:schema depends on utilities from other packages, so we have to build them first, then rebuild once | |
| # we've generated the updated schema. | |
| run: pnpm build | |
| - name: Update schema | |
| run: pnpm update:schema | |
| - name: Build packages with updated schema | |
| run: pnpm build | |
| - name: Run tests | |
| run: pnpm test | |
| - name: Cache npx tools | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-arethetypeswrong-0.18.2 | |
| - name: Validate CJS and ESM resolution for SDK | |
| # Catch issues like https://github.com/linear/linear/issues/830 | |
| run: npx @arethetypeswrong/cli@0.18.2 --pack packages/sdk | |
| - name: Compare schema for changes | |
| uses: graphql-hive/graphql-inspector@8733c10560f98b868d3eb4db1325c8edf64936b3 # @graphql-inspector/action@5.0.21 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| schema: "master:packages/sdk/src/schema.graphql" | |
| fail-on-breaking: false | |
| - name: Create schema pull request | |
| uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7.0.11 | |
| with: | |
| sign-commits: true | |
| commit-message: "feat(sdk): update schema" | |
| title: "feat(sdk): update schema" | |
| body: "Update schema, regenerate types and SDK" | |
| branch: schema | |
| base: master | |
| notify-slack: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: [schema] | |
| permissions: | |
| actions: read | |
| contents: read | |
| if: ${{ always() && github.ref_name == 'master' && contains(needs.*.result, 'failure') }} | |
| steps: | |
| - uses: ravsamhq/notify-slack-action@bca2d7f5660b833a27bda4f6b8bef389ebfefd25 # 2.3.0 | |
| with: | |
| status: ${{ job.status }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| notification_title: "SDK CI check failed on master branch" | |
| message_format: ":x: Check failed in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>" | |
| footer: <{run_url}|View Run> | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |