chore: Auto build docs if only src/docs is changed

This commit is contained in:
Sidharth Vinod 2022-10-03 11:50:42 +08:00
parent 1a46582e1e
commit 21caa3eb72
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
1 changed files with 32 additions and 0 deletions

View File

@ -19,6 +19,16 @@ jobs:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request' }}
with:
fetch-depth: 2
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request' }}
with:
fetch-depth: 2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
@ -38,5 +48,27 @@ jobs:
- name: Run Linting
run: yarn lint
- name: Run changed-files using the fork point of a pull request
id: changed-files-fork-point
uses: tj-actions/changed-files@v29
with:
use_fork_point: 'true'
files: |
src/docs/*
- name: Run step if any file(s) in the docs folder change
if: steps.changed-files-fork-point.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 }}"
yarn docs:build
- name: Commit changes
uses: EndBug/add-and-commit@v9
if: steps.changed-files-fork-point.outputs.only_modified == 'true'
with:
message: 'Update docs'
add: 'docs/*'
- name: Verify Docs
run: yarn docs:verify