Token interop check #1
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: Token interop check | |
| # Proves the published DTCG artifact is not merely schema-valid but actually | |
| # usable: a real third-party consumer (Style Dictionary) rebuilds CSS custom | |
| # properties from static/api/css-tokens.tokens.json, and the result is diffed | |
| # against GravityView's own registry values. | |
| # | |
| # Deliberately separate from deploy.yml. The deploy already refuses to publish a | |
| # file that fails the DTCG schema; this is the stronger, slower check, and a | |
| # regression in a third-party consumer is not a reason to block publishing a | |
| # correct artifact. | |
| # | |
| # The weekly run is the point: it catches UPSTREAM drift, either GravityView | |
| # adding a token whose CSS value form the emitter does not recognise, or a | |
| # Style Dictionary release changing how it renders a DTCG value. | |
| on: | |
| pull_request: | |
| paths: | |
| - 'scripts/lib/dtcg.mjs' | |
| - 'scripts/lib/dtcg.test.mjs' | |
| - 'scripts/generate-tokens.mjs' | |
| - 'scripts/verify-token-interop.mjs' | |
| - '.github/workflows/token-interop.yml' | |
| schedule: | |
| # Mondays 06:00 UTC, a couple of days after the Sunday docs deploy. | |
| - cron: '0 6 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| interop: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| # The token registry is read by running GravityView's PHP CLI tool. | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: none | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Unit tests (DTCG emitter) | |
| run: npm test | |
| - name: Clone GravityKit repositories | |
| run: npm run repos:clone | |
| env: | |
| # Read access to GravityKit product repos (same secret as the deploy). | |
| GH_TOKEN: ${{ secrets.GK_REPOS_TOKEN }} | |
| # Fails the step if the artifact does not satisfy the official DTCG schema. | |
| - name: Generate design tokens | |
| run: npm run tokens:generate | |
| - name: Round-trip through Style Dictionary | |
| run: npm run tokens:verify |