mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
75 lines
2.0 KiB
YAML
75 lines
2.0 KiB
YAML
name: Lint
|
|
|
|
on:
|
|
push: {}
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- ready_for_review
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
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
|
|
|
|
- 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 Linting
|
|
run: pnpm run 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: |
|
|
packages/mermaid/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: 'packages/mermaid/docs/*'
|
|
|
|
- name: Verify Docs
|
|
run: pnpm run docs:verify
|