From 9c5c85d34ac1777a93b8e80b15720a5fccbeb57c Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:24:51 +0800 Subject: [PATCH] Run doc lint only if files changed --- .github/workflows/lint-docs.yml | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 60faeda31..734363a22 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -24,21 +24,6 @@ jobs: # ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 - - uses: pnpm/action-setup@v2 - # uses version from "packageManager" field in package.json - - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - cache: pnpm - node-version: ${{ matrix.node-version }} - - - name: Install Packages - run: | - pnpm install --frozen-lockfile - env: - CYPRESS_CACHE_FOLDER: .cache/Cypress - - name: Run changed-files using the fork point of a pull request id: changed-files-fork-point uses: tj-actions/changed-files@v29 @@ -48,6 +33,24 @@ jobs: packages/mermaid/src/docs/* packages/mermaid/src/docs.mts + - uses: pnpm/action-setup@v2 + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + # uses version from "packageManager" field in package.json + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + with: + cache: pnpm + node-version: ${{ matrix.node-version }} + + - name: Install Packages + if: steps.changed-files-fork-point.outputs.only_modified == 'true' + run: | + pnpm install --frozen-lockfile + env: + CYPRESS_CACHE_FOLDER: .cache/Cypress + - name: Run step if any file(s) in the docs folder change if: steps.changed-files-fork-point.outputs.only_modified == 'true' run: |