ci: remove no-cache #4683
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
| # Copyright (c) HashiCorp, Inc. | |
| # SPDX-License-Identifier: MPL-2.0 | |
| name: 'Next.js Bundle Analysis' | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read # for checkout repository | |
| actions: read # for fetching base branch bundle stats | |
| pull-requests: write # for comments | |
| jobs: | |
| analyze: | |
| if: contains(github.event.pull_request.labels.*.name , 'skip-ci') == false | |
| runs-on: ubuntu-latest | |
| env: | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
| NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN }} | |
| DIGITRANSIT_KEY: ${{ secrets.DIGITRANSIT_KEY }} | |
| NEXT_PUBLIC_DIGITRANSIT_KEY: ${{ secrets.NEXT_PUBLIC_DIGITRANSIT_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4.2.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.21.1 | |
| cache: 'pnpm' | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build next.js app | |
| shell: bash | |
| run: pnpm build --filter=...site... && mv site/.next .next | |
| - name: Analyze bundle | |
| run: pnpm --package nextjs-bundle-analysis dlx report | |
| - name: Upload bundle | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bundle | |
| path: .next/analyze/__bundle_analysis.json | |
| - name: Download base branch bundle stats | |
| uses: dawidd6/action-download-artifact@v10 | |
| if: success() && github.event.number | |
| with: | |
| workflow: nextjs_bundle_analysis.yml | |
| branch: ${{ github.event.pull_request.base.ref }} | |
| path: .next/analyze/base | |
| - name: Compare with base branch bundle | |
| if: success() && github.event.number | |
| run: ls -laR .next/analyze/base && pnpm --package nextjs-bundle-analysis dlx compare | |
| - name: Get Comment Body | |
| id: get-comment-body | |
| if: success() && github.event.number | |
| # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | |
| run: | | |
| echo "body<<EOF" >> $GITHUB_OUTPUT | |
| echo "$(cat .next/analyze/__bundle_analysis_comment.txt)" >> $GITHUB_OUTPUT | |
| echo EOF >> $GITHUB_OUTPUT | |
| - name: Comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: next-touched-pages | |
| message: ${{ steps.get-comment-body.outputs.body }} |