[Do not merge] Test PR for CI updates #1096
Workflow file for this run
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: Docs - Validate nav.ts | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| merge_group: | |
| jobs: | |
| validate-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: true | |
| - name: Get pnpm store directory | |
| working-directory: sdks/typescript | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| working-directory: docs | |
| run: | | |
| pnpm install | |
| - name: Lint | |
| working-directory: docs | |
| run: | | |
| pnpm lint | |
| - name: Backup existing nav.js | |
| working-directory: docs | |
| run: | | |
| mv docs/nav.js docs/nav.js.original | |
| - name: Build nav.ts | |
| working-directory: docs | |
| run: | | |
| pnpm build | |
| - name: Compare generated nav.js with original nav.js | |
| working-directory: docs | |
| run: | | |
| diff -q docs/nav.js docs/nav.js.original || (echo "Generated nav.js differs from committed version. Run 'pnpm build' and commit the updated file." && exit 1) | |
| # We do this after checking that nav.js matches nav.ts, to avoid confusing error messages if an author updates one but not the other. | |
| # If the .ts and .js are in sync, it doesn't matter which one we check against here. | |
| - name: Check that all files are listed in nav.js | |
| working-directory: docs | |
| run: | | |
| cp docs/nav.js docs/nav.mjs | |
| find docs -name '*.md' | sed 's!^docs/!!' > scripts/docs-files.txt | |
| node scripts/checkNav.mjs docs-files.txt | |
| - name: Restore original nav.js | |
| working-directory: docs | |
| if: success() || failure() | |
| run: | | |
| mv docs/nav.js.original docs/nav.js |