From 455c61b2cf38fd8c9739a3b97029cb935574c168 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 3 Oct 2022 14:41:52 +0800 Subject: [PATCH] Run doc lint only if files changed --- .github/workflows/lint-docs.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml index 20caab6f0..312de8b1c 100644 --- a/.github/workflows/lint-docs.yml +++ b/.github/workflows/lint-docs.yml @@ -18,41 +18,37 @@ jobs: node-version: [16.x] steps: - uses: actions/checkout@v3 - # if: ${{ github.event_name == 'pull_request' }} - # with: - # fetch-depth: 0 - # repository: ${{ github.event.pull_request.head.repo.full_name }} - # ref: ${{ github.event.pull_request.head.ref }} + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} - - name: Run changed-files using the fork point of a pull request - id: changed-files-fork-point + - name: Check if source docs are changed + id: changed-docs uses: tj-actions/changed-files@v29 with: - # use_fork_point: 'true' files: | 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 + if: steps.changed-docs.outputs.only_modified == 'true' - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-docs.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' + if: steps.changed-docs.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' + if: steps.changed-docs.outputs.only_modified == 'true' run: | echo "Only files in the src/docs folder has changed." echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}" @@ -60,7 +56,7 @@ jobs: - name: Commit changes uses: EndBug/add-and-commit@v9 - if: steps.changed-files-fork-point.outputs.only_modified == 'true' + if: steps.changed-docs.outputs.only_modified == 'true' with: message: 'Update docs' add: 'docs/*'